module Pipeable def |(other) other.call(self) end end class String include Pipeable end Reverse = ->(string) { string.reverse } Capitalize = ->(string) { string.capitalize } result = "moo" | Reverse | Capitalize | Reverse puts result # => moO