-
-
Save leejarvis/2931184 to your computer and use it in GitHub Desktop.
a bad example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
module GroupSend | |
def group_send(methods, *calls) | |
items = [] | |
Array(methods).each do |meth| | |
calls.each { |c| items << self.send(meth).send(c) } | |
end | |
items | |
end | |
end | |
class TestString < String | |
include GroupSend | |
end | |
str = TestString.new("foo") | |
p str.group_send([:reverse, :upcase], :to_sym) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment