Created
July 8, 2016 14:36
-
-
Save aoitaku/e897dff9174a99eead298382e802bb5c to your computer and use it in GitHub Desktop.
forwardable を拡張する
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
require 'forwardable' | |
module Forwardable | |
def delegate_to(accessor, *methods, **method_hash) | |
methods.each do|method| | |
def_instance_delegator(accessor, method) | |
end | |
method_hash.each do|method, ali| | |
def_instance_delegator(accessor, method, ali) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment