Class: Sbmt::Strangler::Controller

Inherits:
Object
  • Object
show all
Extended by:
Configurable
Defined in:
lib/sbmt/strangler/controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configurable

option

Constructor Details

#initialize(name, configuration) {|_self| ... } ⇒ Controller

Returns a new instance of Controller.

Yields:

  • (_self)

Yield Parameters:



12
13
14
15
16
17
18
19
# File 'lib/sbmt/strangler/controller.rb', line 12

def initialize(name, configuration, &)
  @name = name
  @class_name = "#{name.camelize}Controller"
  @actions = []
  @configuration = configuration

  yield(self)
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



10
11
12
# File 'lib/sbmt/strangler/controller.rb', line 10

def actions
  @actions
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



10
11
12
# File 'lib/sbmt/strangler/controller.rb', line 10

def class_name
  @class_name
end

#configurationObject (readonly)

Returns the value of attribute configuration.



10
11
12
# File 'lib/sbmt/strangler/controller.rb', line 10

def configuration
  @configuration
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/sbmt/strangler/controller.rb', line 10

def name
  @name
end

Instance Method Details

#action(name) ⇒ Object



21
22
23
# File 'lib/sbmt/strangler/controller.rb', line 21

def action(name, &)
  @actions.push(Sbmt::Strangler::Action.new(name, self, &))
end

#httpObject



25
26
27
# File 'lib/sbmt/strangler/controller.rb', line 25

def http
  @http ||= ActiveSupport::InheritableOptions.new(configuration.http)
end