Sha256: cfe1470d80d5f35deeb0c52b503f1b770f99d1389c18c3e01b2d6c748a2a2040
Contents?: true
Size: 685 Bytes
Versions: 63
Compression:
Stored size: 685 Bytes
Contents
module Vault # Pipes and Filters implementations # # Individual filters do work with ::call(object) # # Compose a Pipeline with the ::use method # # Example: # # Pricer = Class.new(Pipeline) # # class AppTierPricer < Pricer # use PlanScoper, Quantizer, AppGrouper # use UserGrouper # end class Pipeline def self.use(*args) @filters ||= [] @filters.push *args end def self.filters @filters end def self.process(thing) return thing unless filters filters.each do |filter| thing = filter.call(thing) yield thing, filter if block_given? end thing end end end
Version data entries
63 entries across 63 versions & 1 rubygems