Class: Alf::Engine::Wrap
Overview
Wraps attributes under as a sub-tuple
Constant Summary
Constants included from Cog
Cog::EMPTY_CHILDREN, Cog::EMPTY_OPTIONS
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.
Attributes included from Compiler::Cog
Instance Method Summary collapse
- #_each ⇒ Object
- #arguments ⇒ Object
-
#initialize(operand, attributes, as, allbut, expr = nil, compiler = nil) ⇒ Wrap
constructor
Creates a SetAttr instance.
Methods included from Cog
#children, #each, #options, #to_s
Methods included from Compiler::Cog
#cog_orders, #orderedby?, #relation_type, #to_ascii_tree, #to_cog, #to_relation
Constructor Details
#initialize(operand, attributes, as, allbut, expr = nil, compiler = nil) ⇒ Wrap
Creates a SetAttr instance
22 23 24 25 26 27 28 |
# File 'lib/alf/engine/wrap.rb', line 22 def initialize(operand, attributes, as, allbut, expr = nil, compiler = nil) super(expr, compiler) @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/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/wrap.rb', line 16 def as @as end |
#attributes ⇒ AttrList (readonly)
Returns Attributes to wrap.
13 14 15 |
# File 'lib/alf/engine/wrap.rb', line 13 def attributes @attributes end |
#operand ⇒ Enumerable (readonly)
Returns The operand.
10 11 12 |
# File 'lib/alf/engine/wrap.rb', line 10 def operand @operand end |
Instance Method Details
#_each ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/alf/engine/wrap.rb', line 31 def _each operand.each do |tuple| rest, key = @attributes.split_tuple(tuple, @allbut) key[@as] = rest yield key end end |
#arguments ⇒ Object
39 40 41 |
# File 'lib/alf/engine/wrap.rb', line 39 def arguments [ attribute ] end |