Class: Typed::Changes
- Inherits:
-
Object
- Object
- Typed::Changes
- Defined in:
- lib/typed/changes.rb
Instance Method Summary collapse
-
#initialize ⇒ Changes
constructor
A new instance of Changes.
- #keys ⇒ Object
- #reset ⇒ Object
- #touch(key) ⇒ Object
Constructor Details
#initialize ⇒ Changes
Returns a new instance of Changes.
3 4 5 |
# File 'lib/typed/changes.rb', line 3 def initialize @hash = {} end |
Instance Method Details
#keys ⇒ Object
15 16 17 |
# File 'lib/typed/changes.rb', line 15 def keys @hash.to_a.sort_by(&:last).map(&:first) end |
#reset ⇒ Object
7 8 9 |
# File 'lib/typed/changes.rb', line 7 def reset @hash = {} end |
#touch(key) ⇒ Object
11 12 13 |
# File 'lib/typed/changes.rb', line 11 def touch(key) @hash[key.to_s] = Time.now end |