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.



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

def initialize
  @dsl = RouteDSL.new
end

Instance Attribute Details

#dslObject (readonly)

Returns the value of attribute dsl.



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

def dsl
  @dsl
end

Instance Method Details

#drawObject



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

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

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



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

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