Class: EmmyHttp::Application
- Inherits:
-
Rack::Builder
- Object
- Rack::Builder
- EmmyHttp::Application
- Defined in:
- lib/emmy_http/server/application.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #configure(&b) ⇒ Object
-
#initialize(app = nil, &block) ⇒ Application
constructor
A new instance of Application.
- #load(file) ⇒ Object
- #load_config ⇒ Object
Constructor Details
#initialize(app = nil, &block) ⇒ Application
7 8 9 10 |
# File 'lib/emmy_http/server/application.rb', line 7 def initialize(app = nil, &block) @config = Emmy::Runner.instance.config.clone super end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/emmy_http/server/application.rb', line 5 def config @config end |
Class Method Details
.app(default_app = nil, &block) ⇒ Object
12 13 14 |
# File 'lib/emmy_http/server/application.rb', line 12 def self.app(default_app = nil, &block) self.new(default_app, &block).to_app end |
Instance Method Details
#configure(&b) ⇒ Object
25 26 27 |
# File 'lib/emmy_http/server/application.rb', line 25 def configure(&b) instance_eval(&b) end |
#load(file) ⇒ Object
16 17 18 |
# File 'lib/emmy_http/server/application.rb', line 16 def load(file) instance_eval(File.read(file), file) end |
#load_config ⇒ Object
20 21 22 23 |
# File 'lib/emmy_http/server/application.rb', line 20 def load_config config = Emmy::Runner.instance.config load "#{config.backend}/#{config.environment}.rb" end |