Skip to content

Instantly share code, notes, and snippets.

@kachick
Created May 22, 2012 05:38
Show Gist options
  • Select an option

  • Save kachick/2766856 to your computer and use it in GitHub Desktop.

Select an option

Save kachick/2766856 to your computer and use it in GitHub Desktop.
Forwardableで追加されるメソッドってpublicだよねという確認?
#!/usr/bin/ruby -w
require 'forwardable'
class B
def aaa
puts 'Yeah!'
end
end
class A
extend Forwardable
def initialize
@recv = B.new
end
def_delegators :@recv, :aaa
private :aaa
def ccc
aaa
end
end
a = A.new
a.ccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment