call snippets

Ruby's call method

Tagged ruby, call  Languages ruby

What does this print:

class RubyCall
  def call(*args)
    puts "Call: #{args}"
  end
end

xxx = RubyCall.new
xxx.("hello", 1, 2, 3)

It calls the #call method and prints "Call: ["hello", 1, 2, 3]".

If you want you can do this:

xxx::call('adsf')
xxx.call('adsf')