Sha256: ae80a25791aa699f12d6febd82a0daf122fc056296bfa4e99178fab67420be60
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
require 'backlog_bulk' require 'ostruct' require 'yaml' module BacklogBulk class Config < OpenStruct 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 def to_h @hash_table end private 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backlog_bulk-0.1.0 | lib/backlog_bulk/config.rb |