Class: VaspUtils::Setting

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

Overview

Class to deal with private settings for VaspUtils.

Defined Under Namespace

Classes: NoEntryError

Instance Method Summary collapse

Constructor Details

#initialize(file = ENV["HOME"] + "/.vasputils") ⇒ Setting



14
15
16
# File 'lib/vasputils/setting.rb', line 14

def initialize(file = ENV["HOME"] + "/.vasputils")
    @data = YAML.load_file(file)
end

Instance Method Details

#[](key) ⇒ Object

Return value corresponding to a key. Raise VaspUtils::Setting::NoEntryError if the key is not exist.



20
21
22
23
24
25
# File 'lib/vasputils/setting.rb', line 20

def [](key)
    unless @data.include? key 
        raise NoEntryError, key
    end
    @data[key]
end