Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def explore(o, &b)
- explore(yield(o)) {|v|b.call(v)} if o
- end
- block = Proc.new do |object|
- puts object.inspect
- object.methods.include?('first') ? object.first : nil
- end
- explore([[:a, :b], [1, 2]]) {|obj| block.call(obj)}
Add Comment
Please, Sign In to add comment