Class: Atomsphere::Query::Builder::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/atomsphere/query/builder/group.rb

Instance Method Summary collapse

Constructor Details

#initialize(expression) ⇒ Group

Returns a new instance of Group.



5
6
7
# File 'lib/atomsphere/query/builder/group.rb', line 5

def initialize expression
  @expression = expression
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



15
16
17
# File 'lib/atomsphere/query/builder/group.rb', line 15

def method_missing m, *args, &block
  __property(@expression, m)
end

Instance Method Details

#group(operator, &block) ⇒ Object



9
10
11
12
13
# File 'lib/atomsphere/query/builder/group.rb', line 9

def group operator, &block
  new_group = GroupingExpression.new(operator)
  Group.new(new_group).instance_eval(&block)
  @expression.nested_expression << new_group
end