Class: Activecube::Query::Item
- Inherits:
-
Object
- Object
- Activecube::Query::Item
- Includes:
- ChainAppender
- Defined in:
- lib/activecube/query/item.rb
Instance Attribute Summary collapse
-
#cube ⇒ Object
readonly
Returns the value of attribute cube.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #alias!(new_key) ⇒ Object
- #append_with!(model, cube_query, table, query) ⇒ Object
-
#initialize(cube, key, definition) ⇒ Item
constructor
A new instance of Item.
- #required_column_names ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cube, key, definition) ⇒ Item
Returns a new instance of Item.
7 8 9 10 11 |
# File 'lib/activecube/query/item.rb', line 7 def initialize cube, key, definition @key = key @cube = cube @definition = definition end |
Instance Attribute Details
#cube ⇒ Object (readonly)
Returns the value of attribute cube.
6 7 8 |
# File 'lib/activecube/query/item.rb', line 6 def cube @cube end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
6 7 8 |
# File 'lib/activecube/query/item.rb', line 6 def definition @definition end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/activecube/query/item.rb', line 6 def key @key end |
Instance Method Details
#alias!(new_key) ⇒ Object
17 18 19 |
# File 'lib/activecube/query/item.rb', line 17 def alias! new_key self.class.new cube, new_key, definition end |
#append_with!(model, cube_query, table, query) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/activecube/query/item.rb', line 25 def append_with! model, cube_query, table, query if definition.respond_to?(:with_expression) && (with_expression = definition.with_expression(model, cube_query, table, query)) with_expression.each_pair do |key, expr| query = try_append_with(query, key, expr) end end query end |
#required_column_names ⇒ Object
13 14 15 |
# File 'lib/activecube/query/item.rb', line 13 def required_column_names definition.class.column_names || [] end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/activecube/query/item.rb', line 21 def to_s "#{definition.class.name}(#{key})" end |