Class: RubyApp::Application

Inherits:
Object
  • Object
show all
Extended by:
Mixins::ConfigurationMixin, Mixins::DelegateMixin
Defined in:
lib/ruby_app/application.rb

Direct Known Subclasses

_APPLICATION_UPCODE_::Application

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::ConfigurationMixin

configuration

Methods included from Mixins::DelegateMixin

exists?, method_missing

Constructor Details

#initializeApplication

Returns a new instance of Application.



18
19
20
# File 'lib/ruby_app/application.rb', line 18

def initialize
  @environment = {}
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



16
17
18
# File 'lib/ruby_app/application.rb', line 16

def environment
  @environment
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/ruby_app/application.rb', line 16

def options
  @options
end

Class Method Details

.create!Object



30
31
32
# File 'lib/ruby_app/application.rb', line 30

def self.create!
  @@_application = ( Kernel.eval(RubyApp::Application.configuration._class) ).new
end

.create_context!(configuration_paths = File.join(RubyApp::ROOT, %w[configuration.yml])) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ruby_app/application.rb', line 38

def self.create_context!(configuration_paths = [File.join(RubyApp::ROOT, %w[configuration.yml])])
  unless RubyApp::Application.exists?
    RubyApp::Configuration.load!(configuration_paths)
    RubyApp::Log.open!
    RubyApp::Application.create!
    begin
      yield
    ensure
      RubyApp::Application.destroy!
      RubyApp::Log.close!
      RubyApp::Configuration.unload!
    end
  end
end

.destroy!Object



34
35
36
# File 'lib/ruby_app/application.rb', line 34

def self.destroy!
  @@_application = nil
end

.exists?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/ruby_app/application.rb', line 26

def self.exists?
  return @@_application ||= nil
end

.getObject



22
23
24
# File 'lib/ruby_app/application.rb', line 22

def self.get
  @@_application ||= nil
end