-
-
Save no6v/5056612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-02-28 trunk 39535) [x86_64-linux]" | |
module PM | |
def m(a, b) | |
end | |
end | |
class PC | |
prepend PM | |
def m(a) | |
end | |
end | |
pm = PC.instance_method(:m) | |
pm.owner # => #<PC:0x000000015c1420> | |
pm.parameters # => [[:req, :a]] | |
PC.new.m(:a, :b) # => nil | |
class RC | |
def m(a) | |
end | |
end | |
module RM | |
refine RC do # !> Refinements are experimental, and the behavior may change in future versions of Ruby! | |
def m(a, b) | |
end | |
end | |
end | |
using RM | |
rm = RC.instance_method(:m) | |
rm.owner # => RC | |
rm.parameters # => [[:req, :a]] | |
RC.new.m(:a, :b) # => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment