I'm trying to retrieve the parameters for a couple instance methods. The idiomatic Ruby way to do this is like so:
class A
def test(id)
puts id
end
end
A.instance_method(:test).parameters
#=> [[:req, :id]]
This approach works most of the time, however I get some strange returns with certain methods and I have no idea why.
module Events
class Repository
def find(id)
#code
end
def delete(id)
#code
end
end
end
Events::Repository.instance_method(:find).parameters
#=> [[:req, :id]]
Events::Repository.instance_method(:delete).parameters
#=> [[:rest, :args], [:block, :block_for_method]]
Is this a Ruby bug?
NOTE: I'm typing the above into the Rails console.