Class: Appstats::Result
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Appstats::Result
- Defined in:
- lib/appstats/result.rb
Instance Method Summary collapse
- #==(o) ⇒ Object (also: #eql?)
- #date_to_s ⇒ Object
- #from_date_to_s ⇒ Object
- #host_to_s ⇒ Object
- #to_date_to_s ⇒ Object
Instance Method Details
#==(o) ⇒ Object Also known as: eql?
49 50 51 |
# File 'lib/appstats/result.rb', line 49 def ==(o) o.class == self.class && o.send(:state) == state end |
#date_to_s ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/appstats/result.rb', line 9 def date_to_s return "" if from_date.nil? && to_date.nil? from_s = nil to_s = nil if !from_date.nil? && to_date.nil? && created_at.nil? from_s = from_date_to_s to_s = "present" elsif !from_date.nil? && to_date.nil? && !created_at.nil? from_s = from_date_to_s to_s = created_at.strftime('%Y-%m-%d') elsif from_date.nil? && !to_date.nil? from_s = "up" to_s = to_date_to_s else from_s = from_date_to_s to_s = to_date_to_s end return from_s if from_s == to_s "#{from_s} to #{to_s}" end |
#from_date_to_s ⇒ Object
33 34 35 36 |
# File 'lib/appstats/result.rb', line 33 def from_date_to_s return "" if from_date.nil? from_date.strftime('%Y-%m-%d') end |
#host_to_s ⇒ Object
43 44 45 46 47 |
# File 'lib/appstats/result.rb', line 43 def host_to_s return host if (db_host.blank? || host == db_host) return db_host if host.blank? "#{host} (host), #{db_host} (db_host)" end |
#to_date_to_s ⇒ Object
38 39 40 41 |
# File 'lib/appstats/result.rb', line 38 def to_date_to_s return "" if to_date.nil? to_date.strftime('%Y-%m-%d') end |