Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (34 sloc) 1.004 kB
module Pacer
module Routes
module RouteOperations
# This method adds the IsUniquePipe to the pipeline and whenever the
# pipeline is built, yields the pipe to the block given here.
#
# See #unique? below for example usage.
def is_unique(&block)
chain_route side_effect: :is_unique, on_build_pipe: block
end
# This method builds a pipe and ataches the IsUniquePipe to the end then
# iterates the pipeline until it finds a unique element or hits the end.
def unique?
check = nil
is_unique { |pipe| check = pipe }.each do
return false unless check.unique?
end
true
end
end
end
module SideEffect
module IsUnique
attr_accessor :on_build_pipe
protected
def attach_pipe(end_pipe)
checked = Pacer::Pipes::IsUniquePipe.new
checked.setStarts end_pipe
on_build_pipe.call checked if on_build_pipe
checked
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.