Class: Awestruct::HandlerChains
- Inherits:
-
Object
- Object
- Awestruct::HandlerChains
- Defined in:
- lib/awestruct/handler_chains.rb
Constant Summary collapse
- DEFAULTS =
[ Awestruct::Handlers::CssTiltHandler::CHAIN, Awestruct::Handlers::RedirectHandler::CHAIN, Awestruct::Handlers::JavascriptHandler::CHAIN, Awestruct::Handlers::AsciidoctorHandler::CHAIN, Awestruct::Handlers::TiltHandler::NON_INTERPOLATION_CHAIN, Awestruct::Handlers::TiltHandler::INTERPOLATION_CHAIN, HandlerChain.new( /.*/, Awestruct::Handlers::VerbatimFileHandler ) ]
Instance Method Summary collapse
- #<<(chain) ⇒ Object
- #[](path) ⇒ Object
-
#initialize(include_defaults = true) ⇒ HandlerChains
constructor
A new instance of HandlerChains.
Constructor Details
#initialize(include_defaults = true) ⇒ HandlerChains
Returns a new instance of HandlerChains.
23 24 25 26 |
# File 'lib/awestruct/handler_chains.rb', line 23 def initialize(include_defaults=true) @chains = [] self << :defaults if include_defaults end |
Instance Method Details
#<<(chain) ⇒ Object
32 33 34 35 |
# File 'lib/awestruct/handler_chains.rb', line 32 def <<(chain) @chains += DEFAULTS and return if ( chain == :defaults ) @chains << chain end |
#[](path) ⇒ Object
28 29 30 |
# File 'lib/awestruct/handler_chains.rb', line 28 def[](path) @chains.detect{|e| e.matches?( path.to_s ) } end |