Class: Soql::Query
- Inherits:
-
Object
- Object
- Soql::Query
- Defined in:
- lib/soql/query.rb
Constant Summary collapse
- TYPES =
{ select: 'select' }.freeze
Instance Method Summary collapse
-
#initialize ⇒ Query
constructor
A new instance of Query.
- #structure_query(args = {}) ⇒ Object
Constructor Details
#initialize ⇒ Query
Returns a new instance of Query.
9 10 11 |
# File 'lib/soql/query.rb', line 9 def initialize @query = '' end |
Instance Method Details
#structure_query(args = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/soql/query.rb', line 13 def structure_query(args = {}) @query = TYPES[args[:type]] @query += " #{join_fields(args[:fields])}" unless args[:fields].empty? @query += join_subqueries(args[:subqueries]) unless args[:subqueries].empty? @query += " from #{args[:object_table]}" unless args[:object_table] == '' @query += " where #{args[:where]}" unless args[:where] == '' @query += " limit #{args[:limit]}" unless args[:limit] == '' @query end |