Class: Chuusha::Config
- Inherits:
-
Object
- Object
- Chuusha::Config
- Defined in:
- lib/chuusha.rb
Instance Attribute Summary collapse
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
- #cache? ⇒ Boolean
- #cache_envs ⇒ Object
- #cache_on_load? ⇒ Boolean
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(config) ⇒ Config
Returns a new instance of Config.
39 40 41 42 43 44 |
# File 'lib/chuusha.rb', line 39 def initialize(config) @config = load_config(config) @variables = @config["variables"] || {} @cache = @config["cache"] || {} default_cache_on_load_to_true end |
Instance Attribute Details
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
37 38 39 |
# File 'lib/chuusha.rb', line 37 def variables @variables end |
Instance Method Details
#cache? ⇒ Boolean
50 51 52 53 |
# File 'lib/chuusha.rb', line 50 def cache? # If we're in rails, always cache ENV['RAILS_ENV'] || cache_envs.include?(ENV['RACK_ENV']) end |
#cache_envs ⇒ Object
46 47 48 |
# File 'lib/chuusha.rb', line 46 def cache_envs @cache["envs"] || ["production"] end |
#cache_on_load? ⇒ Boolean
55 56 57 |
# File 'lib/chuusha.rb', line 55 def cache_on_load? @cache["on_load"] && cache? end |