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.
148 149 150 151 |
# File 'lib/esi/config.rb', line 148 def initialize @routes = [] @servers = [] end |
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
146 147 148 |
# File 'lib/esi/config.rb', line 146 def routes @routes end |
#servers ⇒ Object
Returns the value of attribute servers.
145 146 147 |
# File 'lib/esi/config.rb', line 145 def servers @servers end |
Instance Method Details
#default {|_self| ... } ⇒ Object
160 161 162 163 164 165 |
# File 'lib/esi/config.rb', line 160 def default yield self @routes << { :host => @servers.first.split(':').first, :port => @servers.last.split(':').last, :match_url => 'default' } end |
#match(expr) {|_self| ... } ⇒ Object
153 154 155 156 157 158 |
# File 'lib/esi/config.rb', line 153 def match( expr ) yield self @routes << { :host => @servers.first.split(':').first, :port => @servers.last.split(':').last, :match_url => expr } end |