Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. View all parent class of objects
- Use "ancestors" method to find all parent class.
- eg: "string".class.ancestors
- output: => [String, Comparable, Object, Kernel, BasicObject]
- 2. Add new method to a class without editting existing file
- Test.send(:define_method,"type_name") do
- puts "Coding Test"
- end
- puts t.type_name
- 3.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement