Module: PoiseApplication::AppMixin::Resource
- Includes:
- Poise::Resource
- Included in:
- ServiceMixin::Resource
- Defined in:
- lib/poise_application/app_mixin.rb
Overview
A helper mixin for application resources.
Instance Attribute Summary collapse
-
#path ⇒ String
Base path for the application.
Instance Method Summary collapse
-
#app_state ⇒ Hash<Symbol, Object>
A delegator for accessing the application state.
-
#app_state_environment ⇒ Hash<String, String>
Environment variables stored in the application state.
Instance Attribute Details
#path ⇒ String
Base path for the application.
41 |
# File 'lib/poise_application/app_mixin.rb', line 41 attribute(:path, kind_of: String, name_attribute: true) |
Instance Method Details
#app_state ⇒ Hash<Symbol, Object>
A delegator for accessing the application state. If no application parent is found, the state will be tracked internally within the resource.
48 49 50 51 52 53 54 55 |
# File 'lib/poise_application/app_mixin.rb', line 48 def app_state if parent parent.app_state else # If there isn't a parent, just track within the resource. @local_app_state ||= Mash.new end end |
#app_state_environment ⇒ Hash<String, String>
Environment variables stored in the application state.
60 61 62 |
# File 'lib/poise_application/app_mixin.rb', line 60 def app_state_environment app_state[:environment] ||= Mash.new end |