Class: RubyApp::Application
- Extended by:
- Mixins::ConfigurationMixin, Mixins::DelegateMixin
- Defined in:
- lib/ruby_app/application.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .create! ⇒ Object
- .create_context!(configuration_paths = File.join(RubyApp::ROOT, %w[configuration.yml])) ⇒ Object
- .destroy! ⇒ Object
- .exists? ⇒ Boolean
- .get ⇒ Object
- .root ⇒ Object
- .root=(value) ⇒ Object
- .root_or_nil ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
Methods included from Mixins::ConfigurationMixin
Methods included from Mixins::DelegateMixin
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_app/application.rb', line 18 def initialize @environment = {} RubyApp::Log.info("LOG RubyApp::Application.root = #{RubyApp::Application.root.inspect}") RubyApp::Log.info("LOG RubyApp::Response.configuration.cache.read? = #{RubyApp::Response.configuration.cache.read?}") RubyApp::Log.info("LOG RubyApp::Response.configuration.cache.write? = #{RubyApp::Response.configuration.cache.write?}") end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
16 17 18 |
# File 'lib/ruby_app/application.rb', line 16 def environment @environment end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/ruby_app/application.rb', line 16 def @options end |
Class Method Details
.create! ⇒ Object
48 49 50 |
# File 'lib/ruby_app/application.rb', line 48 def self.create! @@_application = ( Kernel.eval(RubyApp::Application.configuration._class) ).new end |
.create_context!(configuration_paths = File.join(RubyApp::ROOT, %w[configuration.yml])) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ruby_app/application.rb', line 56 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
52 53 54 |
# File 'lib/ruby_app/application.rb', line 52 def self.destroy! @@_application = nil end |
.exists? ⇒ Boolean
44 45 46 |
# File 'lib/ruby_app/application.rb', line 44 def self.exists? return @@_application ||= nil end |
.get ⇒ Object
40 41 42 |
# File 'lib/ruby_app/application.rb', line 40 def self.get @@_application ||= nil end |
.root ⇒ Object
28 29 30 |
# File 'lib/ruby_app/application.rb', line 28 def self.root @@_root ||= '/' end |
.root=(value) ⇒ Object
32 33 34 |
# File 'lib/ruby_app/application.rb', line 32 def self.root=(value) @@_root = value end |