class BacklogBulk::Config

Public Class Methods

new(options = nil) click to toggle source
# File lib/backlog_bulk/config.rb, line 7
def initialize(options = nil)
  @table = {}
  @hash_table = {}

  if options
    if options[:config]
      conf = YAML.load_file(options[:config])
      @table, @hash_table = load_config(conf)
    end

    @table, @hash_table = load_config(options, @table, @hash_table)
  end
end

Public Instance Methods

to_h() click to toggle source
# File lib/backlog_bulk/config.rb, line 21
def to_h
  @hash_table
end

Private Instance Methods

load_config(conf, table = {}, hash_table = {}) click to toggle source
# File lib/backlog_bulk/config.rb, line 26
def load_config(conf, table = {}, hash_table = {})
  table = table.dup
  hash_table = hash_table.dup
  conf.each do |k,v|
    table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v)
    hash_table[k.to_sym] = v

    new_ostruct_member(k)
  end
  [table, hash_table]
end