Class: Arbor::Filter

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/arbor/filter.rb

Constant Summary collapse

OPERATORS =
[:equals, :from, :to, :after, :before, :search, :in, :tagged]

Constants included from Utils

Utils::INFLECTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#attempt, #get_resource_name, #left_pad, #parse_resource_name, #validate

Constructor Details

#initialize(attribute, operator, value) ⇒ Filter

Returns a new instance of Filter.



9
10
11
12
13
# File 'lib/arbor/filter.rb', line 9

def initialize(attribute, operator, value)
  @attribute = attribute
  @operator = validate(operator, OPERATORS)
  @value = value
end

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute.



6
7
8
# File 'lib/arbor/filter.rb', line 6

def attribute
  @attribute
end

#operatorObject

Returns the value of attribute operator.



6
7
8
# File 'lib/arbor/filter.rb', line 6

def operator
  @operator
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/arbor/filter.rb', line 6

def value
  @value
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/arbor/filter.rb', line 15

def to_s
  "filters.#{attribute}.#{operator}=#{value}"
end