Class: ConfigReader

Inherits:
Object
  • Object
show all
Includes:
Canoe::Err
Defined in:
lib/config_reader.rb

Overview

class ConfigReader

Just read a json file

Instance Method Summary collapse

Methods included from Canoe::Err

#abort_on_err, #warn_on_err

Constructor Details

#initialize(file) ⇒ ConfigReader

Returns a new instance of ConfigReader.



9
10
11
# File 'lib/config_reader.rb', line 9

def initialize(file)
  @config_file = file
end

Instance Method Details

#extract_flagsObject



13
14
15
16
# File 'lib/config_reader.rb', line 13

def extract_flags
  abort_on_err("config file #{@config_file} does not exsit") unless File.exist? @config_file
  JSON.parse(File.read(@config_file))
end