Class: Omnis::Operators::NullOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/omnis/operators.rb

Direct Known Subclasses

BeginsWith, Between, Equals, Gte, Matches

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value, opts = {}) ⇒ NullOperator

Returns a new instance of NullOperator.



5
6
7
# File 'lib/omnis/operators.rb', line 5

def initialize(key, value, opts={})
  @key, @value, @opts = key, value, opts
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/omnis/operators.rb', line 4

def key
  @key
end

#optsObject (readonly)

Returns the value of attribute opts.



4
5
6
# File 'lib/omnis/operators.rb', line 4

def opts
  @opts
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/omnis/operators.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



9
10
11
12
13
# File 'lib/omnis/operators.rb', line 9

def ==(other)
  return false unless other.is_a? self.class
  return false unless @key == other.key
  @value == other.value
end

#to_sObject



15
16
17
18
# File 'lib/omnis/operators.rb', line 15

def to_s
  klas = self.class.to_s.downcase.split('::')[-1]
  "#{@key.to_s} #{klas} #{@value}"
end