class FYT::Config

reads and prepares a youtube feed for further processing

Public Class Methods

new(path = nil) click to toggle source
# File lib/fyt/config.rb, line 8
def initialize(path = nil)
  path ||= File.join(Dir.home, '.fyt.config.yml')
  @store = YAML::Store.new(path)

  # populate defaults
  @store.transaction do
    @store[:storage_path] ||= 'storage'
    @store[:server_prefix] ||= 'https://localhost:2017'
    @store[:format_options] ||= '22+140'
    @store[:output_format] ||= 'mp4'
    @store[:feeds] ||= []

    @store.commit
  end
end

Public Instance Methods

[](key) click to toggle source
# File lib/fyt/config.rb, line 24
def [](key)
  @store.transaction { @store[key] }
end
[]=(key, value) click to toggle source
# File lib/fyt/config.rb, line 28
def []=(key, value)
  return if value.is_a?(String) && value.size.zero?

  @store.transaction do
    @store[key] = value
  end
end