class FeedTorrents::Configuration
Public Instance Methods
filter_testing=(value)
click to toggle source
# File lib/feed_torrents/configuration.rb, line 36 def filter_testing=(value) @filter_testing = !!value end
filter_testing?()
click to toggle source
# File lib/feed_torrents/configuration.rb, line 40 def filter_testing? @filter_testing end
logger()
click to toggle source
# File lib/feed_torrents/configuration.rb, line 28 def logger @logger ||= create_logger end
method_missing(method, *args, &block)
click to toggle source
# File lib/feed_torrents/configuration.rb, line 32 def method_missing(method, *args, &block) @source.send(method, *args, &block) end
set_config(hash)
click to toggle source
# File lib/feed_torrents/configuration.rb, line 24 def set_config(hash) @source = OpenStruct.new(hash) end
yaml_from_file(file)
click to toggle source
# File lib/feed_torrents/configuration.rb, line 19 def yaml_from_file(file) set_config YAML.load_file(File.expand_path(file)) nil end
Private Instance Methods
create_logger()
click to toggle source
# File lib/feed_torrents/configuration.rb, line 50 def create_logger if self.log && self.log[:out] == 'STDOUT' || filter_testing? obj = Logger.new(STDOUT) else obj = Logger.new(File.expand_path(self.log[:out]), self.log[:rotate], self.log[:size]) obj.level = Logger.const_get(self.log[:level]) obj.datetime_format = self.log[:format] end obj end
source()
click to toggle source
# File lib/feed_torrents/configuration.rb, line 46 def source @source ||= OpenStruct.new end