4

Let's see an example

ruby-1.9.2-p180 :001 > class Demo
ruby-1.9.2-p180 :002?>   def self.class_method1(a,b=25)
ruby-1.9.2-p180 :003?>     return a + b
ruby-1.9.2-p180 :004?>     end
ruby-1.9.2-p180 :005?>  end



ruby-1.9.2-p180 :007 > m = Demo.method(:class_method1)
ruby-1.9.2-p180 :012 > m.parameters
 => [[:req, :a], [:opt, :b]] 

I have a next question: How can I get default argument value of b ? (25)

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Fivell
  • 11,829
  • 3
  • 61
  • 99

0 Answers0