Skip to content

Instantly share code, notes, and snippets.

@foysavas
Created March 15, 2010 17:21
Show Gist options
  • Save foysavas/333070 to your computer and use it in GitHub Desktop.
Save foysavas/333070 to your computer and use it in GitHub Desktop.
# anybody already using an Object monkey-patch like the one below:
class Object
def send_chain(v)
this = self
v.each { |k| this = this.send(*k) }
this
end
end
# example:
1.send_chain([[:*, 2], :to_s]) # => "2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment