Class: Locator::Boolean::Terms

Inherits:
Array
  • Object
show all
Defined in:
lib/locator/boolean.rb

Direct Known Subclasses

And, Or

Instance Method Summary collapse

Instance Method Details

#and(other) ⇒ Object Also known as: &, |



8
9
10
# File 'lib/locator/boolean.rb', line 8

def and(other)
  other.empty? ? self : And.new(self, other)
end

#and!(other) ⇒ Object



4
5
6
# File 'lib/locator/boolean.rb', line 4

def and!(other)
  replace(self.dup.and(other))
end

#or(other) ⇒ Object



17
18
19
# File 'lib/locator/boolean.rb', line 17

def or(other)
  other.empty? ? self : Or.new(self, other)
end

#or!(other) ⇒ Object



13
14
15
# File 'lib/locator/boolean.rb', line 13

def or!(other)
  replace(self.dup.or(other))
end

#to_sObject



22
23
24
# File 'lib/locator/boolean.rb', line 22

def to_s
  flatten.join(Or.operator)
end