Last active
August 29, 2015 14:15
-
-
Save cdollins/a4d380b8d954adb4178d to your computer and use it in GitHub Desktop.
no private instance operator methods
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
class Klass | |
def test | |
thread_first "", | |
Runner, | |
Runner, | |
Runner | |
self.>> "", | |
Runner, | |
Runner, | |
Runner | |
end | |
def >>(*objs) | |
thread_first objs | |
end | |
private | |
def thread_first(*objs) | |
objs.reduce(objs.shift) do |memo, obj| | |
obj.send(:run, memo) | |
end | |
end | |
class Runner | |
def self.run(obj) | |
obj | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment