Class: Tinypacker::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/tinypacker.rb

Defined Under Namespace

Classes: FileNotFoundError, SyntaxError

Instance Attribute Summary collapse

Instance Method Summary collapse

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_pathObject (readonly)

Returns the value of attribute config_path.



55
56
57
# File 'lib/tinypacker.rb', line 55

def config_path
  @config_path
end

#root_pathObject (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

Returns:

  • (Boolean)


68
69
70
# File 'lib/tinypacker.rb', line 68

def cache_manifest?
  !!@data.fetch(:cache_manifest)
end

#manifest_pathObject



64
65
66
# File 'lib/tinypacker.rb', line 64

def manifest_path
  @root_path.join(@data.fetch(:manifest_path)).to_s
end