Top Level Namespace

Defined Under Namespace

Modules: Transproc

Instance Method Summary collapse

Instance Method Details

#Transproc(fn, *args) ⇒ Function

Access registered functions

Examples:

Transproc(:map_array, Transproc(:to_string))

Transproc(:to_string) >> Transproc(-> v { v.upcase })

Parameters:

  • fn (Symbol, Proc)

    The name of the registered function or an anonymous proc

  • args (Array)

    Optional addition args that a given function may need

Returns:

  • (Function)


81
82
83
84
85
86
87
88
89
90
91
# File 'lib/transproc.rb', line 81

def Transproc(fn, *args)
  case fn
  when Proc then Transproc::Function.new(fn, args: args)
  when Symbol
    fun = Transproc[fn]
    case fun
    when Transproc::Function, Transproc::Composite then fun
    else Transproc::Function.new(fun, args: args)
    end
  end
end