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
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
-
#initialize(app, environment) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(app, environment) ⇒ Context
Returns a new instance of Context.
13 14 15 16 17 18 |
# File 'lib/tzispa/context.rb', line 13 def initialize(app, environment) @env = environment @app = app @cache = Hash.new I18n.locale = app.config.locales.default.to_sym if app.config&.respond_to?(:locales) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/tzispa/context.rb', line 10 def app @app end |
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
10 11 12 |
# File 'lib/tzispa/context.rb', line 10 def cache @cache end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/tzispa/context.rb', line 10 def env @env end |