Class: KindleFortune
- Inherits:
-
Object
- Object
- KindleFortune
- Defined in:
- lib/kindle_fortune.rb,
lib/kindle_fortune/version.rb
Constant Summary collapse
- USERNAME =
`whoami`.strip
- DEFAULT_UPDATED_DATAFILE =
'/Volumes/Kindle/documents/My Clippings.txt'.freeze
- DEFAULT_CURRENT_DATAFILE =
"/Users/#{USERNAME}/.config/kindle_fortune.json".freeze
- VERSION =
'0.0.1'.freeze
Instance Method Summary collapse
- #fetch_cookie ⇒ Object
-
#initialize(updated_datafile:, current_datafile:) ⇒ KindleFortune
constructor
A new instance of KindleFortune.
Constructor Details
#initialize(updated_datafile:, current_datafile:) ⇒ KindleFortune
Returns a new instance of KindleFortune.
11 12 13 14 |
# File 'lib/kindle_fortune.rb', line 11 def initialize(updated_datafile:, current_datafile:) @current_datafile = current_datafile || DEFAULT_CURRENT_DATAFILE @updated_datafile = updated_datafile || DEFAULT_UPDATED_DATAFILE end |
Instance Method Details
#fetch_cookie ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/kindle_fortune.rb', line 16 def if File.exist?(@updated_datafile) then prepare_extracts else import_extracts end raise 'No Kindle highlights detected' unless File.exist?(@current_datafile) = @extracts[rand(@extracts.count)] pretty_print() end |