Class: Pubba::Assets::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/pubba/assets/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#disclaimerObject (readonly)

Returns the value of attribute disclaimer.



6
7
8
# File 'lib/pubba/assets/configuration.rb', line 6

def disclaimer
  @disclaimer
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/pubba/assets/configuration.rb', line 6

def name
  @name
end

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

#processObject



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