Class: Druid::HavingClause

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

Instance Method Summary collapse

Constructor Details

#initialize(metric) ⇒ HavingClause



17
18
19
# File 'lib/druid/having.rb', line 17

def initialize(metric)
  @metric = metric
end

Instance Method Details

#<(value) ⇒ Object



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

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

#>(value) ⇒ Object



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

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

#as_json(*a) ⇒ Object



37
38
39
# File 'lib/druid/having.rb', line 37

def as_json(*a)
  to_hash
end

#to_hashObject



45
46
47
48
49
50
51
# File 'lib/druid/having.rb', line 45

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

#to_json(*a) ⇒ Object



41
42
43
# File 'lib/druid/having.rb', line 41

def to_json(*a)
  to_hash.to_json(*a)
end

#to_sObject



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

def to_s
  to_hash.to_s
end