class Courgette::Chain
Public Class Methods
all()
click to toggle source
# File lib/courgette/chain.rb, line 21 def self.all [ Chain.of(Fetchers::CommutateursFetcher, Processors::DefaultProcessor, Processors::CiscoProcessor) ] end
new(fetcher, processors)
click to toggle source
# File lib/courgette/chain.rb, line 3 def initialize(fetcher, processors) @fetcher = fetcher @processors = processors end
of(fetcher, *processors)
click to toggle source
# File lib/courgette/chain.rb, line 8 def self.of(fetcher, *processors) new(fetcher, processors) end
Public Instance Methods
apply(ip, hash)
click to toggle source
# File lib/courgette/chain.rb, line 12 def apply(ip, hash) raw = @fetcher.new(ip, hash).fetch @processors.map(&:new).inject(raw) { |acc, p| acc = p.process(acc) } end
responsible_of(vendor)
click to toggle source
# File lib/courgette/chain.rb, line 17 def responsible_of(vendor) @fetcher.responsible_of(vendor) end