Module: Quiver::Application

Defined in:
lib/quiver/application.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#routerObject

Returns the value of attribute router.



114
115
116
# File 'lib/quiver/application.rb', line 114

def router
  @router
end

Class Method Details

.included(host) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/quiver/application.rb', line 3

def self.included(host)
  host.send(:extend, ClassMethods)

  host.root_module = host.parent
  host.root_module.const_set(:Adapters, Module.new)
  host.root_module.const_set(:Duties, Module.new)
  host.root_module.const_set(:Endpoints, Module.new)
  host.root_module.const_set(:Models, Module.new)
  host.root_module.const_set(:Mappers, Quiver::Mappers.dup)
  host.root_module.const_set(:Serializers, Module.new)
  host.root_module.const_set(:Tasks, Quiver::Tasks.dup)
  host.root_module.const_set(:Logger, Quiver::Logger.dup)
  host.root_module.const_set(:DutyMaster, Quiver::DutyMaster.dup)
  host.root_module.const_set(:DutyTestHelper, Quiver::DutyTestHelper.dup)
  host.memory_adapter_store = Quiver::Adapter::MemoryAdapterStore.new

  application_file = caller[0].partition(':').first
  host.app_root = File.expand_path('..', File.dirname(application_file))
  host.lib_dir = File.join(host.app_root, 'lib', File.basename(application_file, '.rb'))
  host.default_adapter_type = :memory
  host.default_duty_queue_backend = :memory
end

Instance Method Details

#call(env) ⇒ Object



120
121
122
# File 'lib/quiver/application.rb', line 120

def call(env)
  self.class.middleware_stack.stack(router).call(env)
end

#initializeObject



116
117
118
# File 'lib/quiver/application.rb', line 116

def initialize
  self.router = self.class.root_module::Config::Router.new
end