Skip to content

Instantly share code, notes, and snippets.

@cdollins
Last active August 29, 2015 14:15
Show Gist options
  • Save cdollins/a4d380b8d954adb4178d to your computer and use it in GitHub Desktop.
Save cdollins/a4d380b8d954adb4178d to your computer and use it in GitHub Desktop.
no private instance operator methods
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