Skip to content

Instantly share code, notes, and snippets.

@seejohnrun
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seejohnrun/1fac606a8e59fd71fbde to your computer and use it in GitHub Desktop.
Save seejohnrun/1fac606a8e59fd71fbde to your computer and use it in GitHub Desktop.
satirical ruby
class String
def |(other)
other.call(*self)
end
def >(other)
File.write(other, *self)
0
end
end
# define a method that we want to pipe into
def reverse(arg)
arg.reverse
end
# pipe away
'john' | method(:reverse) > 'out.json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment