Class: Tzispa::Context
- Inherits:
-
Object
- Object
- Tzispa::Context
- Extended by:
- Forwardable
- Defined in:
- lib/tzispa/context.rb
Overview
This class defines a environment to hold application state in runtime
Direct Known Subclasses
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #app ⇒ Object
-
#initialize(environment) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(environment) ⇒ Context
Returns a new instance of Context.
13 14 15 16 17 |
# File 'lib/tzispa/context.rb', line 13 def initialize(environment) @env = environment @repository = app.repository.dup if app.repository I18n.locale = config.locales.default.to_sym if config.respond_to?(:locales) end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/tzispa/context.rb', line 10 def env @env end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
10 11 12 |
# File 'lib/tzispa/context.rb', line 10 def repository @repository end |
Instance Method Details
#app ⇒ Object
19 20 21 |
# File 'lib/tzispa/context.rb', line 19 def app @app ||= env[Tzispa::ENV_TZISPA_APP] end |