Skip to content

Instantly share code, notes, and snippets.

@ruliana
Last active December 21, 2015 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruliana/6217685 to your computer and use it in GitHub Desktop.
Save ruliana/6217685 to your computer and use it in GitHub Desktop.
Find methods parameters
class Test
def initialize(param1, *param2, param3, param4: '', param5: nil)
end
end
params = Test.instance_method(:initialize).parameters
puts params.inspect
# => [[:req, :param1],
# [:rest, :param2],
# [:req, :param3],
# [:key, :param4],
# [:key, :param5]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment