Advertisement
Guest User

Untitled

a guest
May 25th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. class MyParentClass
  2. def method_
  3. p 'test'
  4. end
  5. end
  6. => :method_
  7. class ChildClass < DelegateClass(MyParentClass)
  8. end
  9.  
  10. c = ChildClass.new(MyParentClass.new) #=> #<MyParentClass:0x007ffcaaab0280>
  11. c.class #=> ChildClass
  12. c.method_ #=> "test"
  13. c.respond_to?(:method_) #=> true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement