Class: Belt::Application::Routes

Inherits:
Object
  • Object
show all
Defined in:
lib/belt/route_dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRoutes

Returns a new instance of Routes.



277
278
279
# File 'lib/belt/route_dsl.rb', line 277

def initialize
  @dsl = RouteDSL.new
end

Instance Attribute Details

#dslObject (readonly)

Returns the value of attribute dsl.



275
276
277
# File 'lib/belt/route_dsl.rb', line 275

def dsl
  @dsl
end

Instance Method Details

#drawObject



281
282
283
284
# File 'lib/belt/route_dsl.rb', line 281

def draw(&)
  instance_eval(&) if block_given?
  @dsl
end

#namespace(name, options = {}) ⇒ Object



286
287
288
289
290
# File 'lib/belt/route_dsl.rb', line 286

def namespace(name, options = {}, &)
  gateway = Belt::ApiGateway.new(name, options)
  RouteBuilder.new(gateway).instance_eval(&) if block_given?
  @dsl.api_gateways << gateway
end