Class: SocialStream::Population::Timestamps
- Inherits:
-
Object
- Object
- SocialStream::Population::Timestamps
- Defined in:
- lib/social_stream/population/timestamps.rb
Constant Summary collapse
- SCOPE =
1.month
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Instance Method Summary collapse
-
#initialize ⇒ Timestamps
constructor
A new instance of Timestamps.
Constructor Details
#initialize ⇒ Timestamps
Returns a new instance of Timestamps.
8 9 10 11 12 13 14 15 |
# File 'lib/social_stream/population/timestamps.rb', line 8 def initialize created = rand(SCOPE) update = [ true, false ].sample updated = update ? rand(created) : created @created = Time.at(Time.now.to_i - created) @updated = Time.at(Time.now.to_i - updated) end |
Instance Attribute Details
#created ⇒ Object (readonly)
Returns the value of attribute created.
6 7 8 |
# File 'lib/social_stream/population/timestamps.rb', line 6 def created @created end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
6 7 8 |
# File 'lib/social_stream/population/timestamps.rb', line 6 def updated @updated end |