Module: Nasty::Specification

Included in:
BlockSpecification
Defined in:
lib/nasty/block_specification.rb

Instance Method Summary collapse

Instance Method Details

#and(other_predicate = nil, &block) ⇒ Object



8
9
10
11
# File 'lib/nasty/block_specification.rb', line 8

def and(other_predicate = nil, &block)
  matcher = create_predicate(other_predicate, &block)
  create_predicate { |item| self.matches?(item) && matcher.matches?(item) }
end

#notObject



13
14
15
# File 'lib/nasty/block_specification.rb', line 13

def not
  create_predicate { |item| !self.matches?(item) }
end

#or(other_predicate = nil, &block) ⇒ Object



3
4
5
6
# File 'lib/nasty/block_specification.rb', line 3

def or(other_predicate = nil, &block)
  matcher = create_predicate(other_predicate, &block)
  create_predicate { |item| self.matches?(item) || matcher.matches?(item) }
end