Class: Restforce::Query::WhereRenderer
- Inherits:
-
Object
- Object
- Restforce::Query::WhereRenderer
- Defined in:
- lib/restforce/query/where_renderer.rb
Overview
Private class, used by Restforce::Query
Constant Summary collapse
- MAX_WHERE_SIZE =
12_000
- WhereTooLargeError =
StandardError.new("Maximum WHERE size of #{MAX_WHERE_SIZE} exceeded")
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(custom_conditions, conditions) ⇒ WhereRenderer
constructor
A new instance of WhereRenderer.
- #render ⇒ Object
Constructor Details
#initialize(custom_conditions, conditions) ⇒ WhereRenderer
Returns a new instance of WhereRenderer.
7 8 9 10 |
# File 'lib/restforce/query/where_renderer.rb', line 7 def initialize(custom_conditions, conditions) @custom_conditions = custom_conditions || [] @conditions = conditions || [] end |
Class Method Details
.render(custom_conditions, conditions) ⇒ Object
12 13 14 |
# File 'lib/restforce/query/where_renderer.rb', line 12 def self.render(custom_conditions, conditions) new(custom_conditions, conditions).render end |
Instance Method Details
#render ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/restforce/query/where_renderer.rb', line 16 def render conditions_text = render_custom + render_connector + render_conditions return '' if conditions_text.strip.size.zero? result = " WHERE #{conditions_text}" raise WhereTooLargeError if result.size > MAX_WHERE_SIZE result end |