Class: Ordinary::Units

Inherits:
Array
  • Object
show all
Includes:
Composable
Defined in:
lib/ordinary/unit.rb

Instance Method Summary collapse

Methods included from Composable

#<<, #>>, #instance_id, #owned?, #owned_by, #owner

Instance Method Details

#inspectObject



81
82
83
# File 'lib/ordinary/unit.rb', line 81

def inspect
  "#<#{instance_id} #{owner} [#{map(&:inspect) * ', '}]>"
end

#to_procObject



76
77
78
79
# File 'lib/ordinary/unit.rb', line 76

def to_proc
  processes = map(&:to_proc)
  lambda { |value| processes.reduce(value) { |v, p| p.call(v) } }
end

#with(*arguments) ⇒ Object



72
73
74
# File 'lib/ordinary/unit.rb', line 72

def with(*arguments)
  self.class.new(map { |unit| unit.with(*arguments) })
end