Class: Pubba::Assets::Configuration
- Inherits:
-
Object
- Object
- Pubba::Assets::Configuration
- Defined in:
- lib/pubba/assets/configuration.rb
Instance Attribute Summary collapse
-
#disclaimer ⇒ Object
readonly
Returns the value of attribute disclaimer.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Instance Method Summary collapse
- #global_config! ⇒ Object
-
#initialize(config_file) ⇒ Configuration
constructor
A new instance of Configuration.
- #process ⇒ Object
Constructor Details
#initialize(config_file) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 |
# File 'lib/pubba/assets/configuration.rb', line 8 def initialize(config_file) @yaml = Psych.load_file(config_file) @name = File.basename(config_file) @disclaimer = "// This file is automatically generated from the contents\n// in #{name}\n//\n" end |
Instance Attribute Details
#disclaimer ⇒ Object (readonly)
Returns the value of attribute disclaimer.
6 7 8 |
# File 'lib/pubba/assets/configuration.rb', line 6 def disclaimer @disclaimer end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/pubba/assets/configuration.rb', line 6 def name @name end |
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
6 7 8 |
# File 'lib/pubba/assets/configuration.rb', line 6 def yaml @yaml end |
Instance Method Details
#global_config! ⇒ Object
14 15 16 |
# File 'lib/pubba/assets/configuration.rb', line 14 def global_config! @global_config ||= (yaml.delete("global") || {}) end |
#process ⇒ Object
18 19 20 21 22 |
# File 'lib/pubba/assets/configuration.rb', line 18 def process yaml.each do |page, config| yield page, config end end |