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.



270
271
272
# File 'lib/belt/route_dsl.rb', line 270

def initialize
  @dsl = RouteDSL.new
end

Instance Attribute Details

#dslObject (readonly)

Returns the value of attribute dsl.



268
269
270
# File 'lib/belt/route_dsl.rb', line 268

def dsl
  @dsl
end

Instance Method Details

#drawObject



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

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

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



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

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