• Input_file = ARGV.first

    From Cai Gengyang@21:1/5 to All on Tue Apr 19 03:02:58 2016
    What does this line in Ruby : Input_file = ARGV.first mean ?

    How does it work? Can give an example ? HELP , HELP .....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jacki@21:1/5 to Cai Gengyang on Tue Apr 19 12:43:02 2016
    W dniu 2016-04-19 o 12:02, Cai Gengyang pisze:
    What does this line in Ruby : Input_file = ARGV.first mean ?

    How does it work? Can give an example ? HELP , HELP .....


    $ cat argv.rb
    #!/usr/bin/env ruby

    puts ARGV.inspect


    $ ruby argv.rb hard to say
    ["hard", "to", "say"]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Cai Gengyang@21:1/5 to jacki on Tue Apr 19 04:12:39 2016
    Oh ok, so for the question in the study drill --- "Write English comments for each line to understand what that line does." , what should I write beside the line Input_file = ARGV.first ?

    I am trying to complete this exercise : http://learnrubythehardway.org/book/ex20.html

    Thx ...

    On Tuesday, April 19, 2016 at 6:43:02 PM UTC+8, jacki wrote:
    W dniu 2016-04-19 o 12:02, Cai Gengyang pisze:
    What does this line in Ruby : Input_file = ARGV.first mean ?

    How does it work? Can give an example ? HELP , HELP .....


    $ cat argv.rb
    #!/usr/bin/env ruby

    puts ARGV.inspect


    $ ruby argv.rb hard to say
    ["hard", "to", "say"]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jacki@21:1/5 to All on Tue Apr 19 15:52:41 2016
    W dniu 2016-04-19 o 13:12, Cai Gengyang pisze:
    Oh ok, so for the question in the study drill --- "Write English comments for each line to understand what that line does." , what should I write beside the line Input_file = ARGV.first ?


    set input_file to first elemant of array ARGV

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)