Module: Stitcher::Operators

Defined in:
lib/stitcher/operators.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.require_other(other) ⇒ Object



7
8
9
# File 'lib/stitcher/operators.rb', line 7

def self.require_other other
	Proc === other || Class === other
end

Instance Method Details

#!Object



21
22
23
# File 'lib/stitcher/operators.rb', line 21

def !
	proc { |it, &block| !(self.===(it, &block)) }
end

#&(other) ⇒ Object



11
12
13
14
# File 'lib/stitcher/operators.rb', line 11

def & other
	return super(other) unless Operators.require_other other
	proc { |it, &block| self.===(it, &block) && other.===(it, &block)  }
end

#|(other) ⇒ Object



16
17
18
19
# File 'lib/stitcher/operators.rb', line 16

def | other
	return super(other) unless Operators.require_other other
	proc { |it, &block| self.===(it, &block) || other.===(it, &block)  }
end