Class: Appfuel::Feature::ActionLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/appfuel/feature/action_loader.rb

Overview

Loads an action from the container using its fully qualified namespace. This class has been abstracted out because its Appfuel’s implementation of loading an action. This action loader is injected into the container during setup which allows the client to use their own if this basic lookup mehtod does not work for them.

The idea is that all actions, commands and repositories auto register themselves into the container based on a namespace derived inpart by their own ruby namespace.

Instance Method Summary collapse

Instance Method Details

#call(namespace, container) ⇒ Appfuel::Handler::Action

Parameters:

  • namespace (String)

    fully qualifed container namespace

  • container (Dry::Container)

    application container

Returns:



17
18
19
20
21
22
# File 'lib/appfuel/feature/action_loader.rb', line 17

def call(namespace, container)
  unless container.key?(namespace)
    fail "[ActionLoader] Could not load action at #{namespace}"
  end
  container[namespace]
end