module Nasty::Specification
Public Instance Methods
and(other_predicate = nil, &block)
click to toggle source
# 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
not()
click to toggle source
# File lib/nasty/block_specification.rb, line 13 def not create_predicate { |item| !self.matches?(item) } end
or(other_predicate = nil, &block)
click to toggle source
# 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
Private Instance Methods
create_predicate(predicate = nil, &block)
click to toggle source
# File lib/nasty/block_specification.rb, line 19 def create_predicate(predicate = nil, &block) block_given? ? Nasty::BlockSpecification.new(&block) : predicate end