Class: Flounder::Expression::Builder
- Inherits:
-
Object
- Object
- Flounder::Expression::Builder
- Defined in:
- lib/flounder/expression.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
Instance Method Summary collapse
- #call(&block) ⇒ Object
-
#initialize(domain) ⇒ Builder
constructor
A new instance of Builder.
-
#interpret_conditions(entity, conditions) ⇒ Object
Conditions are interpreted relative to an entity.
- #method_missing(sym, *args, &block) ⇒ Object
- #respond_to?(sym, include_all = false) ⇒ Boolean
Constructor Details
#initialize(domain) ⇒ Builder
Returns a new instance of Builder.
130 131 132 |
# File 'lib/flounder/expression.rb', line 130 def initialize domain @domain = domain end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
134 135 136 |
# File 'lib/flounder/expression.rb', line 134 def domain @domain end |
Instance Method Details
#call(&block) ⇒ Object
136 137 138 |
# File 'lib/flounder/expression.rb', line 136 def call &block instance_eval(&block) end |
#interpret_conditions(entity, conditions) ⇒ Object
Conditions are interpreted relative to an entity.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/flounder/expression.rb', line 141 def interpret_conditions entity, conditions # The method we need is in there... query = Flounder::Query::Select.new(domain, entity) engine = Flounder::Engine.new(domain.connection_pool) and_expr = BinaryOp.new(domain, 'AND') # TODO parse_conditions and its call tree is not really something that # belongs into the query object - we should create a new abstraction here. query.parse_conditions(*conditions) { |bit| and_expr.concat(ConditionBit.new(domain, engine, bit)) } and_expr end |
#respond_to?(sym, include_all = false) ⇒ Boolean
156 157 158 |
# File 'lib/flounder/expression.rb', line 156 def respond_to? sym, include_all=false true end |