Class: Influxdb::Arel::Clauses::WhereClause

Inherits:
Base
  • Object
show all
Includes:
Expressions
Defined in:
lib/influxdb/arel/clauses/where_clause.rb

Instance Method Summary collapse

Methods included from Expressions

#bottom, #count, #derivative, #difference, #distinct, #first, #histogram, #last, #max, #mean, #median, #min, #mode, #percentile, #stddev, #sum, #top

Methods inherited from Base

#o

Constructor Details

#initialize(conditions, &block) ⇒ WhereClause

Returns a new instance of WhereClause.



7
8
9
10
# File 'lib/influxdb/arel/clauses/where_clause.rb', line 7

def initialize(conditions, &block)
  @conditions = build_where_expression(conditions)
  super(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



20
21
22
# File 'lib/influxdb/arel/clauses/where_clause.rb', line 20

def method_missing(method, *args, &block)
  a(method)
end

Instance Method Details

#a(name) ⇒ Object



12
13
14
# File 'lib/influxdb/arel/clauses/where_clause.rb', line 12

def a(name)
  Nodes::Attribute.new(name) #.extend(:math, :predications)
end

#nowObject



16
17
18
# File 'lib/influxdb/arel/clauses/where_clause.rb', line 16

def now
  Nodes::Now.new
end

#to_arelObject



24
25
26
# File 'lib/influxdb/arel/clauses/where_clause.rb', line 24

def to_arel
  super{|result| [@conditions, result].flatten.compact.inject(&:and) }
end