Class: SitemapBoiler::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_hash) ⇒ Config

Returns a new instance of Config.



8
9
10
# File 'lib/sitemap_boiler/config.rb', line 8

def initialize(config_hash)
  @config_hash = DefaultConfig.merge(config_hash)
end

Instance Attribute Details

#config_hashObject

Returns the value of attribute config_hash.



6
7
8
# File 'lib/sitemap_boiler/config.rb', line 6

def config_hash
  @config_hash
end

Class Method Details

.from_file(config_path) ⇒ Object



16
17
18
19
# File 'lib/sitemap_boiler/config.rb', line 16

def self.from_file config_path
  config_hash = JSON.parse(File.read(config_path))
  new(config_hash)
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/sitemap_boiler/config.rb', line 12

def [](key)
  config_hash[key.to_s]
end