Class: IronBank::QueryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_bank/query_builder.rb

Overview

A query builder helps buidling a syntaxically correct query using ZOQL.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.zoql(object, fields, conditions = {}) ⇒ Object



9
10
11
# File 'lib/iron_bank/query_builder.rb', line 9

def self.zoql(object, fields, conditions = {})
  new(object, fields, conditions).zoql
end

Instance Method Details

#zoqlObject



13
14
15
16
# File 'lib/iron_bank/query_builder.rb', line 13

def zoql
  query = "select #{query_fields} from #{object}"
  conditions.empty? ? query : "#{query} where #{query_conditions}"
end