Class: Transproc::Composer::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/transproc/composer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default = nil) ⇒ Factory

Returns a new instance of Factory.



7
8
9
10
# File 'lib/transproc/composer.rb', line 7

def initialize(default = nil)
  @fns = []
  @default = default
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



5
6
7
# File 'lib/transproc/composer.rb', line 5

def default
  @default
end

#fnsObject (readonly)

Returns the value of attribute fns.



5
6
7
# File 'lib/transproc/composer.rb', line 5

def fns
  @fns
end

Instance Method Details

#<<(other) ⇒ Object



12
13
14
15
# File 'lib/transproc/composer.rb', line 12

def <<(other)
  fns.concat(Array(other).compact)
  self
end

#to_fnObject



17
18
19
# File 'lib/transproc/composer.rb', line 17

def to_fn
  fns.reduce(:+) || default
end