fast_timestamp 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/fast_timestamp.gemspec +2 -2
- data/lib/fast_timestamp.rb +9 -5
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/fast_timestamp.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fast_timestamp}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Seamus Abshere"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-11}
|
13
13
|
s.description = %q{Rapidly and arbitrarily timestamp ActiveRecord records}
|
14
14
|
s.email = %q{seamus@abshere.net}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/fast_timestamp.rb
CHANGED
@@ -5,11 +5,7 @@ module FastTimestamp
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def timestamp!(key)
|
8
|
-
|
9
|
-
transaction do
|
10
|
-
t = ::Timestamp.find_or_create_by_timestampable_type_and_timestampable_id_and_key(self.class.base_class.name, id, key.to_s)
|
11
|
-
t.update_attribute :stamped_at, Time.zone.now
|
12
|
-
end
|
8
|
+
set_timestamp! key, Time.zone.now
|
13
9
|
end
|
14
10
|
|
15
11
|
def untimestamp!(key)
|
@@ -29,6 +25,14 @@ module FastTimestamp
|
|
29
25
|
t.read_attribute :stamped_at
|
30
26
|
end
|
31
27
|
end
|
28
|
+
|
29
|
+
def set_timestamp!(key, time)
|
30
|
+
raise "Can't timestamp new records" if new_record?
|
31
|
+
transaction do
|
32
|
+
t = ::Timestamp.find_or_create_by_timestampable_type_and_timestampable_id_and_key(self.class.base_class.name, id, key.to_s)
|
33
|
+
t.update_attribute :stamped_at, time
|
34
|
+
end
|
35
|
+
end
|
32
36
|
|
33
37
|
def fast_destroy_timestamps
|
34
38
|
::Timestamp.destroy_all :timestampable_type => self.class.base_class.name, :timestampable_id => id
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_timestamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-11 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|