Sha256: ea7e67c415564c17787e209fb3ffd0f33d7e3515f21c7c964913b3b9f188fe9c
Contents?: true
Size: 352 Bytes
Versions: 3
Compression:
Stored size: 352 Bytes
Contents
module Transproc class Function attr_reader :fn, :args def initialize(fn, args = []) @fn = fn @args = args end def call(value) fn[value, *args] end alias_method :[], :call def compose(other) self.class.new(-> *result { other[fn[*result]] }, args) end alias_method :+, :compose end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
transproc-0.1.2 | lib/transproc/function.rb |
transproc-0.1.1 | lib/transproc/function.rb |
transproc-0.1.0 | lib/transproc/function.rb |