Module: Scrapbooker::Utilities
- Defined in:
- lib/scrapbooker/utilities.rb
Instance Method Summary collapse
- #configuration ⇒ Object
- #configure {|configuration| ... } ⇒ Object
- #last_update ⇒ Object
- #timestamp_exists? ⇒ Boolean
- #timestamp_file ⇒ Object
- #timestamp_is_current? ⇒ Boolean
- #update_scrapbook ⇒ Object
- #update_scrapbook? ⇒ Boolean
- #update_timestamp ⇒ Object
Instance Method Details
#configuration ⇒ Object
8 9 10 |
# File 'lib/scrapbooker/utilities.rb', line 8 def configuration @configuration ||= Configuration.new end |
#configure {|configuration| ... } ⇒ Object
4 5 6 |
# File 'lib/scrapbooker/utilities.rb', line 4 def configure yield configuration end |
#last_update ⇒ Object
39 40 41 |
# File 'lib/scrapbooker/utilities.rb', line 39 def last_update Time.parse(File.read()) end |
#timestamp_exists? ⇒ Boolean
27 28 29 |
# File 'lib/scrapbooker/utilities.rb', line 27 def File.exists?() ? true : false end |
#timestamp_file ⇒ Object
35 36 37 |
# File 'lib/scrapbooker/utilities.rb', line 35 def "#{self.configuration.}/#{self.name.underscore}_last_update" end |
#timestamp_is_current? ⇒ Boolean
23 24 25 |
# File 'lib/scrapbooker/utilities.rb', line 23 def last_update > self.configuration.update_interval.minutes.ago end |
#update_scrapbook ⇒ Object
17 18 19 20 21 |
# File 'lib/scrapbooker/utilities.rb', line 17 def update_scrapbook #Get results from active services poll_twitter? end |
#update_scrapbook? ⇒ Boolean
12 13 14 15 |
# File 'lib/scrapbooker/utilities.rb', line 12 def update_scrapbook? update_scrapbook if ! update_scrapbook if ! end |
#update_timestamp ⇒ Object
31 32 33 |
# File 'lib/scrapbooker/utilities.rb', line 31 def File.open(, "w+") {|f| f.write(Time.now)} end |