Class: Website
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Website
- Defined in:
- app/models/website.rb
Overview
Schema Information
Table name: websites
id :integer not null, primary key
title :string
url :string
created_at :datetime
updated_at :datetime
strategy :string
Instance Method Summary collapse
- #get_strategy ⇒ Object
-
#strategy_check_count ⇒ Object
TODO should record on website record.
- #strategy_title ⇒ Object
- #strategy_update_images(minutes) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#get_strategy ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/models/website.rb', line 23 def get_strategy if !strategy.nil? and !strategy.blank? strategy.constantize.new else false end end |
#strategy_check_count ⇒ Object
TODO should record on website record
41 42 43 44 45 46 47 48 |
# File 'app/models/website.rb', line 41 def strategy_check_count s = get_strategy if s s.check_count(self) else [] end end |
#strategy_title ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/models/website.rb', line 31 def strategy_title s = get_strategy if s s.title else "" end end |
#strategy_update_images(minutes) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'app/models/website.rb', line 50 def strategy_update_images(minutes) s = get_strategy if s s.update(self, minutes) else Rails.logger.info("No strategy set for #{title}") end end |
#to_s ⇒ Object
19 20 21 |
# File 'app/models/website.rb', line 19 def to_s title end |