On 21 July 2014 13:20, Juanjo Conti <jjconti / gmail.com> wrote:

> Ok... can I say that a method in upercase with no arguements can't be
> called?
>
> 2.1.2 :010 > def Aja(*args)
> 2.1.2 :011?>   puts 'aja'
> 2.1.2 :012?>   end
>  => :Aja
> 2.1.2 :013 > Aja
> NameError: uninitialized constant Aja
>     from (irb):13
>
>     from /home/juanjo/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `<main>'
> 2.1.2 :014 > Aja 1
> aja
>  => nil
>
>
You can add parentheses:

irb(main):001:0> def Aja *args
irb(main):002:1>   puts 'aja'
irb(main):003:1> end
=> :Aja
irb(main):004:0> Aja()
aja
=> nil

But generally speaking, yes, you need the arguments list to tell the parser
that it's a function call.


-- 
  Matthew Kerwin
  http://matthew.kerwin.net.au/