Module: PoiseApplicationPython::AppMixin::Resource

Includes:
PoiseApplication::AppMixin::Resource, PoisePython::PythonCommandMixin::Resource
Included in:
ServiceMixin::Resource
Defined in:
lib/poise_application_python/app_mixin.rb

Overview

A helper mixin for Python application resources.

Since:

  • 4.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_state_pythonObject

Since:

  • 4.0.0



44
45
46
47
48
49
# File 'lib/poise_application_python/app_mixin.rb', line 44

def app_state_python(python=Poise::NOT_PASSED)
  unless python == Poise::NOT_PASSED
    app_state[:python] = python
  end
  app_state[:python]
end

#parent_pythonPoisePython::Resources::PythonRuntime::Resource?

Override the #parent_python from PythonCommandMixin to grok the application level parent as a default value.

Returns:

  • (PoisePython::Resources::PythonRuntime::Resource, nil)


39
# File 'lib/poise_application_python/app_mixin.rb', line 39

parent_attribute(:python, type: :python_runtime, optional: true, default: lazy { app_state_python.equal?(self) ? nil : app_state_python })

Instance Method Details

#app_state_environment_pythonHash<String, String>

A merged hash of environment variables for both the application state and parent python.

Returns:

  • (Hash<String, String>)

Since:

  • 4.0.0



55
56
57
58
59
# File 'lib/poise_application_python/app_mixin.rb', line 55

def app_state_environment_python
  env = app_state_environment
  env = env.merge(parent_python.python_environment) if parent_python
  env
end