Class: ESI::Config::ConfigRouter

Inherits:
Object
  • Object
show all
Defined in:
lib/esi/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigRouter

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

#routesObject (readonly)

Returns the value of attribute routes.



146
147
148
# File 'lib/esi/config.rb', line 146

def routes
  @routes
end

#serversObject

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

Yields:

  • (_self)

Yield Parameters:



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

Yields:

  • (_self)

Yield Parameters:



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