Class: GAShikomi::Config

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

Defined Under Namespace

Classes: FileNotFound

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Config



5
6
7
8
9
# File 'lib/ga_shikomi/config.rb', line 5

def initialize(file)
  @config = {}

  load(file)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/ga_shikomi/config.rb', line 10

def config
  @config
end

Instance Method Details

#load(file) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/ga_shikomi/config.rb', line 12

def load(file)
  if File.exist? file
    @config = YAML.load_file(file)
  else
    raise FileNotFound, "config_file #{file}"
  end
end