Class: ESI::Config::ConfigRouter
- Inherits:
-
Object
- Object
- ESI::Config::ConfigRouter
- Defined in:
- lib/esi/config.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
-
#servers ⇒ Object
Returns the value of attribute servers.
Instance Method Summary collapse
- #default {|_self| ... } ⇒ Object
-
#initialize ⇒ ConfigRouter
constructor
A new instance of ConfigRouter.
- #match(expr) {|_self| ... } ⇒ Object
Constructor Details
#initialize ⇒ ConfigRouter
Returns a new instance of ConfigRouter.
145 146 147 148 |
# File 'lib/esi/config.rb', line 145 def initialize @routes = [] @servers = [] end |
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
143 144 145 |
# File 'lib/esi/config.rb', line 143 def routes @routes end |
#servers ⇒ Object
Returns the value of attribute servers.
142 143 144 |
# File 'lib/esi/config.rb', line 142 def servers @servers end |
Instance Method Details
#default {|_self| ... } ⇒ Object
157 158 159 160 161 162 |
# File 'lib/esi/config.rb', line 157 def default yield self @routes << { :host => @servers.first.split(':').first, :port => @servers.last.split(':').last, :match_url => 'default' } end |
#match(expr) {|_self| ... } ⇒ Object
150 151 152 153 154 155 |
# File 'lib/esi/config.rb', line 150 def match( expr ) yield self @routes << { :host => @servers.first.split(':').first, :port => @servers.last.split(':').last, :match_url => expr } end |