Class: AllTweets::Settings
- Inherits:
-
Object
- Object
- AllTweets::Settings
- Defined in:
- lib/alltweets/settings.rb
Constant Summary collapse
- INITIAL_SETTINGS =
{ consumer_key: "GyRoi6Jx4T4olW1Rfwgfaa5kv", consumer_secret: "OHx2XugBhtg7kuI4yaPANXh3rplREN0Si8CoLzVWYpkeDyH3NJ" }
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #add_access_tokens(access_token, access_token_secret) ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(filename = File.expand_path("~/.alltweets")) ⇒ Settings
constructor
A new instance of Settings.
Constructor Details
#initialize(filename = File.expand_path("~/.alltweets")) ⇒ Settings
Returns a new instance of Settings.
11 12 13 14 |
# File 'lib/alltweets/settings.rb', line 11 def initialize(filename = File.("~/.alltweets")) @filename = filename @settings = load_file end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
16 17 18 |
# File 'lib/alltweets/settings.rb', line 16 def filename @filename end |
Instance Method Details
#add_access_tokens(access_token, access_token_secret) ⇒ Object
24 25 26 27 28 |
# File 'lib/alltweets/settings.rb', line 24 def add_access_tokens(access_token, access_token_secret) @settings[:access_token] = access_token @settings[:access_token_secret] = access_token_secret dump_file end |
#exist? ⇒ Boolean
30 31 32 |
# File 'lib/alltweets/settings.rb', line 30 def exist? FileTest.exist?(@filename) end |