Class: Alf::Engine::Wrap
- Inherits:
-
Object
- Object
- Alf::Engine::Wrap
- Includes:
- Cog
- Defined in:
- lib/alf-engine/alf/engine/wrap.rb
Overview
Wraps attributes under as a sub-tuple
Instance Attribute Summary collapse
-
#allbut ⇒ Boolean
readonly
Allbut wrapping?.
-
#as ⇒ AttrName
readonly
Name of the introduced wrapped attribute.
-
#attributes ⇒ AttrList
readonly
Attributes to wrap.
-
#operand ⇒ Enumerable
readonly
The operand.
Instance Method Summary collapse
- #_each ⇒ Object
-
#initialize(operand, attributes, as, allbut) ⇒ Wrap
constructor
Creates a SetAttr instance.
Methods included from Cog
Constructor Details
#initialize(operand, attributes, as, allbut) ⇒ Wrap
Creates a SetAttr instance
22 23 24 25 26 27 |
# File 'lib/alf-engine/alf/engine/wrap.rb', line 22 def initialize(operand, attributes, as, allbut) @operand = operand @attributes = attributes @as = as @allbut = allbut end |
Instance Attribute Details
#allbut ⇒ Boolean (readonly)
Returns Allbut wrapping?.
19 20 21 |
# File 'lib/alf-engine/alf/engine/wrap.rb', line 19 def allbut @allbut end |
#as ⇒ AttrName (readonly)
Returns Name of the introduced wrapped attribute.
16 17 18 |
# File 'lib/alf-engine/alf/engine/wrap.rb', line 16 def as @as end |
#attributes ⇒ AttrList (readonly)
Returns Attributes to wrap.
13 14 15 |
# File 'lib/alf-engine/alf/engine/wrap.rb', line 13 def attributes @attributes end |
#operand ⇒ Enumerable (readonly)
Returns The operand.
10 11 12 |
# File 'lib/alf-engine/alf/engine/wrap.rb', line 10 def operand @operand end |
Instance Method Details
#_each ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/alf-engine/alf/engine/wrap.rb', line 30 def _each operand.each do |tuple| rest, key = @attributes.split_tuple(tuple, @allbut) key[@as] = rest yield key end end |