Sha256: 93443e8ae3938e898f2a195fa35acf51dd5f10008b75ca73997608b8281adb41
Contents?: true
Size: 381 Bytes
Versions: 1
Compression:
Stored size: 381 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(-> *input { other[fn[*input]] }, args) end alias_method :+, :compose alias_method :>>, :compose end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transproc-0.1.3 | lib/transproc/function.rb |