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.

Since:

  • 5.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathString

Base path for the application.

Returns:

  • (String)


41
# File 'lib/poise_application/app_mixin.rb', line 41

attribute(:path, kind_of: String, name_attribute: true)

Instance Method Details

#app_stateHash<Symbol, Object>

A delegator for accessing the application state. If no application parent is found, the state will be tracked internally within the resource.

Returns:

  • (Hash<Symbol, Object>)

Since:

  • 5.0.0



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_environmentHash<String, String>

Environment variables stored in the application state.

Returns:

  • (Hash<String, String>)

Since:

  • 5.0.0



60
61
62
# File 'lib/poise_application/app_mixin.rb', line 60

def app_state_environment
  app_state[:environment] ||= Mash.new
end