Class: Olap::QueryBuilder
- Inherits:
-
Object
- Object
- Olap::QueryBuilder
- Defined in:
- lib/olap4r/query_builder.rb
Instance Method Summary collapse
- #from(cube) ⇒ Object
-
#initialize ⇒ QueryBuilder
constructor
A new instance of QueryBuilder.
- #select(axis, *fields) ⇒ Object
- #to_s ⇒ Object
- #where(*conditions) ⇒ Object
Constructor Details
#initialize ⇒ QueryBuilder
Returns a new instance of QueryBuilder.
3 4 5 6 7 |
# File 'lib/olap4r/query_builder.rb', line 3 def initialize @select = {:columns => [], :rows => []} @from = nil @conditions = [] end |
Instance Method Details
#from(cube) ⇒ Object
14 15 16 17 |
# File 'lib/olap4r/query_builder.rb', line 14 def from cube @from = cube self end |
#select(axis, *fields) ⇒ Object
9 10 11 12 |
# File 'lib/olap4r/query_builder.rb', line 9 def select axis, *fields fields.flatten.each { |field| @select[axis] << field_as_string(field) } self end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/olap4r/query_builder.rb', line 24 def to_s build_query end |
#where(*conditions) ⇒ Object
19 20 21 22 |
# File 'lib/olap4r/query_builder.rb', line 19 def where *conditions conditions.flatten.each { |condition| @conditions << condition } self end |