class Ovto::WiredActionSet

Set of WiredActions (One for the app, zero or more for middlewares)

Constants

I_AM_APP_NOT_A_MIDDLEWARE

Special key for @hash

THE_MIDDLEWARE_ITSELF

Attributes

app[R]
middleware_names[R]

Public Class Methods

dummy() click to toggle source

For testing

# File lib/ovto/wired_action_set.rb, line 11
def self.dummy()
  new(nil, nil, [], [], nil)
end
new(app, actions, middleware_path, middlewares, runtime) click to toggle source
# File lib/ovto/wired_action_set.rb, line 15
def initialize(app, actions, middleware_path, middlewares, runtime)
  @app = app
  @hash = {}
  @hash[THE_MIDDLEWARE_ITSELF] = WiredActions.new(actions, app, runtime, self)
  middlewares.each do |m|
    mw_path = middleware_path + [m.name]
    mw_actions = m.const_get('Actions').new(mw_path)
    mw_wired_action_set = WiredActionSet.new(app, mw_actions, mw_path, m.middlewares, runtime)
    @hash[m.name] = mw_wired_action_set
    mw_actions.wired_actions = mw_wired_action_set[THE_MIDDLEWARE_ITSELF]
  end
  @middleware_names = middlewares.map(&:name).to_set
end

Public Instance Methods

[](name) click to toggle source

Return the WiredActions of a middleware

# File lib/ovto/wired_action_set.rb, line 36
def [](name)
  @hash.fetch(name)
end
app_wired_actions() click to toggle source

Return the WiredActions of the app

# File lib/ovto/wired_action_set.rb, line 31
def app_wired_actions
  @hash[I_AM_APP_NOT_A_MIDDLEWARE]
end