Class: Tinypacker::Configuration
- Inherits:
-
Object
- Object
- Tinypacker::Configuration
- Defined in:
- lib/tinypacker.rb
Defined Under Namespace
Classes: FileNotFoundError, SyntaxError
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #cache_manifest? ⇒ Boolean
-
#initialize(root_path:, env: Rails.env) ⇒ Configuration
constructor
A new instance of Configuration.
- #manifest_path ⇒ Object
Constructor Details
#initialize(root_path:, env: Rails.env) ⇒ Configuration
Returns a new instance of Configuration.
57 58 59 60 61 62 |
# File 'lib/tinypacker.rb', line 57 def initialize(root_path:, env: Rails.env) @root_path = root_path @config_path = root_path.join("config/tinypacker.yml") @env = env @data = load(@config_path) end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
55 56 57 |
# File 'lib/tinypacker.rb', line 55 def config_path @config_path end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
55 56 57 |
# File 'lib/tinypacker.rb', line 55 def root_path @root_path end |
Instance Method Details
#cache_manifest? ⇒ Boolean
68 69 70 |
# File 'lib/tinypacker.rb', line 68 def cache_manifest? !!@data.fetch(:cache_manifest) end |
#manifest_path ⇒ Object
64 65 66 |
# File 'lib/tinypacker.rb', line 64 def manifest_path @root_path.join(@data.fetch(:manifest_path)).to_s end |