Class: Awestruct::HandlerChain
- Inherits:
-
Object
- Object
- Awestruct::HandlerChain
- Defined in:
- lib/awestruct/handler_chain.rb
Instance Attribute Summary collapse
-
#handler_classes ⇒ Object
readonly
Returns the value of attribute handler_classes.
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Instance Method Summary collapse
- #create(site, path) ⇒ Object
-
#initialize(matcher, *handler_classes) ⇒ HandlerChain
constructor
A new instance of HandlerChain.
- #matches?(path) ⇒ Boolean
Constructor Details
#initialize(matcher, *handler_classes) ⇒ HandlerChain
Returns a new instance of HandlerChain.
9 10 11 12 |
# File 'lib/awestruct/handler_chain.rb', line 9 def initialize(matcher, *handler_classes) @matcher = matcher @handler_classes = handler_classes end |
Instance Attribute Details
#handler_classes ⇒ Object (readonly)
Returns the value of attribute handler_classes.
7 8 9 |
# File 'lib/awestruct/handler_chain.rb', line 7 def handler_classes @handler_classes end |
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
6 7 8 |
# File 'lib/awestruct/handler_chain.rb', line 6 def matcher @matcher end |
Instance Method Details
#create(site, path) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/awestruct/handler_chain.rb', line 18 def create(site, path) cur = path @handler_classes.each do |cls| cur = cls.new( site, cur ) end cur end |
#matches?(path) ⇒ Boolean
14 15 16 |
# File 'lib/awestruct/handler_chain.rb', line 14 def matches?(path) @matcher.match( path ) end |