Class: AlgebraDB::Build::SelectList
- Inherits:
-
Struct
- Object
- Struct
- AlgebraDB::Build::SelectList
- Defined in:
- lib/algebra_db/build/select_list.rb
Overview
Build up a select list.
Defined Under Namespace
Classes: RowDecoder
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(*selects) ⇒ SelectList
constructor
A new instance of SelectList.
- #render_syntax(builder) ⇒ Object
- #row_decoder ⇒ Object
Constructor Details
#initialize(*selects) ⇒ SelectList
Returns a new instance of SelectList.
6 7 8 9 10 11 12 13 14 |
# File 'lib/algebra_db/build/select_list.rb', line 6 def initialize(*selects) super(selects.flat_map { |i| convert_select_item(i) }) items.each do |i| same_name = items.select { |i2| i2.select_alias == i.select_alias } raise ArgumentError, "duplicate key #{i.select_alias}" if same_name.count > 1 end end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items
5 6 7 |
# File 'lib/algebra_db/build/select_list.rb', line 5 def items @items end |
Instance Method Details
#render_syntax(builder) ⇒ Object
16 17 18 19 20 |
# File 'lib/algebra_db/build/select_list.rb', line 16 def render_syntax(builder) builder.separate(items) do |i, b| i.render_syntax(b) end end |
#row_decoder ⇒ Object
49 50 51 |
# File 'lib/algebra_db/build/select_list.rb', line 49 def row_decoder RowDecoder.new(items) end |