Class: Tzispa::Context

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/tzispa/context.rb

Overview

This class defines a environment to hold application state in runtime

Direct Known Subclasses

Http::Context

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#appObject (readonly)

Returns the value of attribute app.



10
11
12
# File 'lib/tzispa/context.rb', line 10

def app
  @app
end

#cacheObject (readonly)

Returns the value of attribute cache.



10
11
12
# File 'lib/tzispa/context.rb', line 10

def cache
  @cache
end

#envObject (readonly)

Returns the value of attribute env.



10
11
12
# File 'lib/tzispa/context.rb', line 10

def env
  @env
end