Sha256: 67807b507a77dd2477ff1193736475ea401a75ffc4c05087117bacc0be482f7e
Contents?: true
Size: 534 Bytes
Versions: 5
Compression:
Stored size: 534 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require 'yaml' # Class to deal with private settings for VaspUtils. class VaspUtils::Setting attr_reader :filename class NoEntryError < Exception; end # def initialize(file = ENV["HOME"] + "/.vasputils") @filename = file @data = YAML.load_file(file) end # Return value corresponding to a key. # Raise VaspUtils::Setting::NoEntryError if the key is not exist. def [](key) unless @data.include? key raise NoEntryError, key end @data[key] end end
Version data entries
5 entries across 5 versions & 1 rubygems