Class: Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/popcorn/settings.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.conf_fileObject

Returns the value of attribute conf_file.



11
12
13
# File 'lib/popcorn/settings.rb', line 11

def conf_file
  @conf_file
end

.libraryObject

Returns the value of attribute library.



11
12
13
# File 'lib/popcorn/settings.rb', line 11

def library
  @library
end

Class Method Details

.write_settings(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/popcorn/settings.rb', line 13

def write_settings(options={})
  defaults = { :library => @default_library.to_s }
  options = defaults.merge(options)
  puts "Writing file."
  @conf_file.open("w") do |f|
    config = { :popcorn => options }
    f.write(config.to_yaml)
  end
  FileUtils.mkdir_p(Pathname(options[:library]).expand_path.to_s)
end