Sha256: 774cbf833e871fbd59a46e147ea14888444670ca195f65fa5ff85314f862a5ed

Contents?: true

Size: 419 Bytes

Versions: 3

Compression:

Stored size: 419 Bytes

Contents

# Simple settings class used to configure download path
class FileSettings
  DOWNLOAD_DIRECTORY = '~/Music/'.freeze

  attr_accessor :folder, :subfolder

  def initialize(folder = nil)
    @folder = folder || DOWNLOAD_DIRECTORY
  end

  def filepath(name)
    @folder + @subfolder.to_s + sanitize(name) + '.m4a'
  end

  def sanitize(name)
    return '' if name.nil? || name == ''
    name.strip.tr('/', '|')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ytsongdw-0.2.0 lib/file_settings.rb
ytsongdw-0.1.4 lib/file_settings.rb
ytsongdw-0.1.3 lib/file_settings.rb