Class: FlickrSync::Preferences

Inherits:
Object
  • Object
show all
Defined in:
lib/flickr_sync/preferences.rb

Instance Method Summary collapse

Constructor Details

#initializePreferences

Returns a new instance of Preferences.



5
6
7
8
9
10
11
12
# File 'lib/flickr_sync/preferences.rb', line 5

def initialize
  @preference_path = home_path '.flickr_sync'
  if File.exists? @preference_path
    @preferences = YAML.load File.read(@preference_path)
  else
    @preferences = {}
  end
end

Instance Method Details

#[](key) ⇒ Object



14
15
16
# File 'lib/flickr_sync/preferences.rb', line 14

def [] key
  @preferences[key]
end

#[]=(key, value) ⇒ Object



18
19
20
21
# File 'lib/flickr_sync/preferences.rb', line 18

def []= key, value
  @preferences[key] = value
  persist
end