class Writer::Configuration
Attributes
attributes[RW]
creator[RW]
date_format[RW]
log_level[RW]
logger[RW]
namer[RW]
template_path[RW]
Public Class Methods
new(attrs = {})
click to toggle source
# File lib/writer/configuration.rb, line 9 def initialize(attrs = {}) attrs = attrs.merge(config) attrs.each do |attr, value| self.send("#{attr}=", value) end @attributes = attrs end
Public Instance Methods
creator=(other)
click to toggle source
# File lib/writer/configuration.rb, line 27 def creator=(other) @creator = Object.const_get(other) end
logger=(other)
click to toggle source
# File lib/writer/configuration.rb, line 23 def logger=(other) @logger = Object.const_get(other) end
namer=(other)
click to toggle source
# File lib/writer/configuration.rb, line 19 def namer=(other) @namer = Object.const_get(other) end
Private Instance Methods
config()
click to toggle source
# File lib/writer/configuration.rb, line 32 def config conf = default_config path = 'config/writer.yml' if File.exist?(path) config_file = File.open(path) user_config = YAML.load(config_file) conf = conf.merge(user_config) end conf end
default_config()
click to toggle source
# File lib/writer/configuration.rb, line 46 def default_config { namer: 'Writer::FileNamer', creator: 'Writer::FileCreator', logger: 'Writer::Logger', date_format: '%Y-%m%b-%d', log_level: 2, # see Logger for levels template_path: '' } end