Class: PUNK::Env
- Defined in:
- lib/punk/core/env.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Env
constructor
A new instance of Env.
- #logger ⇒ Object
Methods inherited from Settings
#method_missing, #respond_to_missing?
Constructor Details
#initialize(*args) ⇒ Env
Returns a new instance of Env.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/punk/core/env.rb', line 15 def initialize(*args) super(*args) return unless args.empty? @loaded = false parent_methods = Module.new do def to_s raise InternalServerError, "Environment not yet loaded" unless @loaded env.to_s end def to_sym raise InternalServerError, "Environment not yet loaded" unless @loaded env.to_sym end def env ActiveSupport::StringInquirer.new(self[:env].to_s) end def task ActiveSupport::StringInquirer.new(self[:task].to_s) end def load! return if @loaded _load @loaded = true end end extend(parent_methods) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PUNK::Settings
Instance Method Details
#logger ⇒ Object
11 12 13 |
# File 'lib/punk/core/env.rb', line 11 def logger SemanticLogger['PUNK::Env'] end |