class JamesBond::Core::Config

Constants

ENV_PLACEHOLDER
RESERVED_COMMANDS

Attributes

missions[RW]
raw_hash[RW]
yaml_path[RW]

Public Class Methods

new(params={}) click to toggle source
# File lib/james_bond/core/config.rb, line 13
def initialize(params={})
  @yaml_path = params[:yaml_path]

  extract_config_from_yaml(@yaml_path)
end

Private Instance Methods

extract_config_from_yaml(yaml_path) click to toggle source
# File lib/james_bond/core/config.rb, line 21
def extract_config_from_yaml(yaml_path)
  @raw_hash = YAML.load(File.read(yaml_path))
  @missions = @raw_hash["missions"]

  validate_config
end
validate_config() click to toggle source
# File lib/james_bond/core/config.rb, line 28
def validate_config
  raise "Please provide at least one mission to work with 007!" if !@missions || @missions.empty?
end