Class: Localeapp::SyncData
- Inherits:
-
Struct
- Object
- Struct
- Localeapp::SyncData
- Defined in:
- lib/localeapp/sync_file.rb
Instance Attribute Summary collapse
-
#polled_at ⇒ Object
Returns the value of attribute polled_at.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#polled_at ⇒ Object
Returns the value of attribute polled_at
24 25 26 |
# File 'lib/localeapp/sync_file.rb', line 24 def polled_at @polled_at end |
#updated_at ⇒ Object
Returns the value of attribute updated_at
24 25 26 |
# File 'lib/localeapp/sync_file.rb', line 24 def updated_at @updated_at end |
Class Method Details
.default ⇒ Object
25 26 27 |
# File 'lib/localeapp/sync_file.rb', line 25 def self.default new(0, 0) end |
.from_hash(hash) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/localeapp/sync_file.rb', line 29 def self.from_hash(hash) return default unless hash.is_a?(Hash) new( hash['polled_at'] || hash[:polled_at], hash['updated_at'] || hash[:updated_at] ) end |
Instance Method Details
#to_hash ⇒ Object
37 38 39 |
# File 'lib/localeapp/sync_file.rb', line 37 def to_hash {'polled_at' => polled_at.to_i, 'updated_at' => updated_at.to_i} end |
#to_yaml ⇒ Object
41 42 43 |
# File 'lib/localeapp/sync_file.rb', line 41 def to_yaml to_hash.to_yaml end |