Class: Druid::HavingClause

Inherits:
HavingFilter show all
Defined in:
lib/druid/having.rb

Instance Method Summary collapse

Methods inherited from HavingFilter

#clause?, #operator?

Methods included from Serializable

#as_json, #to_json, #to_s

Constructor Details

#initialize(metric) ⇒ HavingClause

Returns a new instance of HavingClause.



23
24
25
# File 'lib/druid/having.rb', line 23

def initialize(metric)
  @metric = metric
end

Instance Method Details

#<(value) ⇒ Object



27
28
29
30
31
# File 'lib/druid/having.rb', line 27

def <(value)
  @type = "lessThan"
  @value = value
  self
end

#>(value) ⇒ Object



33
34
35
36
37
# File 'lib/druid/having.rb', line 33

def >(value)
  @type = "greaterThan"
  @value = value
  self
end

#to_hashObject



39
40
41
42
43
44
45
# File 'lib/druid/having.rb', line 39

def to_hash
  {
    :type => @type,
    :aggregation => @metric,
    :value => @value
  }
end