Sha256: 03a2bb17f2e4089362f097fb0bf1de849d892bbc0b9fc98d159848d2cf9fbfb0
Contents?: true
Size: 1004 Bytes
Versions: 24
Compression:
Stored size: 1004 Bytes
Contents
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
Version data entries
24 entries across 24 versions & 1 rubygems