Class: Bitsa::Settings

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

Overview

Application settings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auto_checkObject (readonly)

Number of days before auto checking



35
36
37
# File 'lib/bitsa/settings.rb', line 35

def auto_check
  @auto_check
end

#cache_file_pathObject (readonly)

Path to file to store cached contact information in.



32
33
34
# File 'lib/bitsa/settings.rb', line 32

def cache_file_path
  @cache_file_path
end

#loginObject (readonly)

Login to use to connect to GMail.



26
27
28
# File 'lib/bitsa/settings.rb', line 26

def 
  @login
end

#passwordObject (readonly)

Password to use to connect to GMail.



29
30
31
# File 'lib/bitsa/settings.rb', line 29

def password
  @password
end

Instance Method Details

#load(config_file_hash, options) ⇒ Object

Load settings from a hash of data from the configuration file and options passed on the command line.

Options passed on the command line override those in the configuration file.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/bitsa/settings.rb', line 42

def load(config_file_hash, options)
  @login = config_file_hash.data[:login]
  @password = config_file_hash.data[:password]
  @cache_file_path = config_file_hash.data[:cache_file_path]
  @auto_check = config_file_hash.data[:auto_check]

  @login = options[:login] if options[:login]
  @password = options[:password] if options[:password]
  @cache_file_path = options[:cache_file_path] if options[:cache_file_path]
  @auto_check = options[:auto_check] if options[:auto_check]

  @auto_check ||= 1
  @cache_file_path ||= "~/.bitsa_cache.yml"
end