Class: Settings
Instance Method Summary collapse
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
- #oauth_token ⇒ Object
- #oauth_token=(token) ⇒ Object
- #review_mode ⇒ Object
- #save! ⇒ Object
- #username ⇒ Object
- #username=(username) ⇒ Object
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/settings.rb', line 8 def initialize @config_file = File.join( Dir.home, '.git_review.yml' ) @config = if File.exists?(@config_file) YAML.load_file(@config_file) || {} else {} end end |
Instance Method Details
#oauth_token ⇒ Object
31 32 33 |
# File 'lib/settings.rb', line 31 def oauth_token @config['oauth_token'] end |
#oauth_token=(token) ⇒ Object
35 36 37 |
# File 'lib/settings.rb', line 35 def oauth_token=(token) @config['oauth_token'] = token end |
#review_mode ⇒ Object
27 28 29 |
# File 'lib/settings.rb', line 27 def review_mode @config['review_mode'] end |
#save! ⇒ Object
21 22 23 24 25 |
# File 'lib/settings.rb', line 21 def save! File.open(@config_file, 'w') do |file| file.write(YAML.dump(@config)) end end |
#username ⇒ Object
39 40 41 |
# File 'lib/settings.rb', line 39 def username @config['username'] end |
#username=(username) ⇒ Object
43 44 45 |
# File 'lib/settings.rb', line 43 def username=(username) @config['username'] = username end |