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.



294
295
296
# File 'lib/belt/route_dsl.rb', line 294

def initialize
  @dsl = RouteDSL.new
end

Instance Attribute Details

#dslObject (readonly)

Returns the value of attribute dsl.



292
293
294
# File 'lib/belt/route_dsl.rb', line 292

def dsl
  @dsl
end

Instance Method Details

#drawObject



298
299
300
301
# File 'lib/belt/route_dsl.rb', line 298

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

#gateway(name, options = {}) ⇒ Object Also known as: namespace

Primary DSL keyword: defines an API Gateway with a default Lambda function.



304
305
306
307
308
# File 'lib/belt/route_dsl.rb', line 304

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