Sha256: 917d41f7bb105a3adbcb4148609e9c0324146252bcbafc480f3c8b935e15f853

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

require 'transproc/version'
require 'transproc/function'
require 'transproc/composer'

module Transproc
  def self.register(*args, &block)
    name, fn = *args
    functions[name] = fn || block
  end

  def self.functions
    @_functions ||= {}
  end

  def self.[](name)
    functions.fetch(name)
  end
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
transproc-0.1.3 lib/transproc.rb
transproc-0.1.2 lib/transproc.rb
transproc-0.1.1 lib/transproc.rb
transproc-0.1.0 lib/transproc.rb