module ChainOfResponsibility
Constants
- MethodNotImplementedError
- NoAppropriateHandlerFoundError
- VERSION
Public Class Methods
included(base)
click to toggle source
# File lib/chain_of_responsibility.rb, line 6 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
chain()
click to toggle source
# File lib/chain_of_responsibility.rb, line 20 def chain build_chain(self.class.handlers) end
Private Instance Methods
build_chain(handlers)
click to toggle source
# File lib/chain_of_responsibility.rb, line 26 def build_chain(handlers) handler, *remaining = handlers if remaining.empty? handler.new else handler.new(build_chain(remaining)) end end