historyable 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjkzMWQ0Mjk3OGMwODJhMGQzNjViZDNiMjg1N2VkYTg4OGU2M2UxNw==
4
+ NmJlMGExNTA0M2I4ZTQ5MWIzOWRkMzM1M2UwYTgwOWQ3NmY2MGE4Yg==
5
5
  data.tar.gz: !binary |-
6
- MjQyMDFmZDlhZTRmMGVmYjlmNDk2MTRjNmY1ZGE2NDIxNzFjOGNiYg==
6
+ OGNmYWIxNGFhYWQ5ZDVkMzBkOGUzOGRjOWNiM2ZkNjM0YzkwYWYwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWQ4YWE3ODhkN2U1MGJiYTVkYjBmMzZjYzg2NjcyOWNhY2RlZjU5Yzc4NmMx
10
- OTBmMjg0ZDZkZTdkNWI2YjFkNWViZTBjOTIyYzFmYWE3YWU0NjM5ZTZjOGI4
11
- ODk3MmUxYzZhMjVkZDRkOTU4ODJlN2ZiNjY2YTc2MGM3NWY4MGM=
9
+ MGMzZGZhYTJkNjMzM2I1ZDgwMTU4Y2NlOTY0YTdiNTBmZWRkYzg3NTFiNmNj
10
+ YWU2NTMzNjBhMzk1YTU2N2MyZWIwM2I5NzJhMTg2MWFmZmI1OTkzOTdlMzU0
11
+ NDlkNDEyNTUyNDhhOGQxZjhiMWY3NjBkYWNjOGVlMDM0NzJhZGE=
12
12
  data.tar.gz: !binary |-
13
- Mzk3YmYzNDFhYTk2MDExZjlhNDZkNDI3YzhjMWRjNmRiMWZlMjI4MDE3MDQy
14
- YmI4OTQ0MThlODQ3N2Q2OTkxMjZjZmZlMjhhOGFlYWNkMjdmNmU4ODViYjVi
15
- YWMwYWRkYzU0ZmY4MDI4MDg5MjVkYWY5NGNmMTFlZTYzZWE5NmE=
13
+ Yjg1NjdhMDRlNzY5MTlhMmExZjkzMDQyNmU0ODAxM2NjMjgzNWRiNjZjMTli
14
+ OWUyZDAyNDIxOWRjZGQzMDlkNWVjYjk2OTFkZmU5YTJiYjdkMzU5NDk5ZjU3
15
+ ZjdhN2U0NjUxODZiYmJkMTcxMGQzOTA2OTlmOGJiNmU1YTNhZmQ=
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/historyable.rb CHANGED
@@ -8,6 +8,8 @@ module Historyable
8
8
 
9
9
  Item = Struct.new(:attribute_name, :association_name)
10
10
 
11
+ Entry = Struct.new(:attribute_value, :changed_at)
12
+
11
13
  included do
12
14
  class_attribute :historyable_items, instance_writer: false
13
15
  attr_accessor :historyable_cache
@@ -79,13 +81,11 @@ module Historyable
79
81
  define_method("#{historyable.attribute_name.to_s}_history") do
80
82
  self.historyable_cache ||= Hash.new
81
83
  historyable_cache[historyable.attribute_name] ||= send("#{historyable.attribute_name}_history_raw").inject([]) do |memo, record|
82
- # @TODO Create a class instead of a hash to store the attributes value
83
- # instead of doing collection.map {|hash| hash[:changed_at] } will do collection.map(&:changed_at)
84
- item = HashWithIndifferentAccess.new
85
- item[:attribute_value] = record.object_attribute_value
86
- item[:changed_at] = record.created_at
84
+ entry = Entry.new
85
+ entry.attribute_value = record.object_attribute_value
86
+ entry.changed_at = record.created_at
87
87
 
88
- memo << item
88
+ memo << entry
89
89
  end
90
90
  end
91
91
  end
@@ -1,3 +1,3 @@
1
1
  module Historyable
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: historyable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philippe Dionne
@@ -38,7 +38,7 @@ cert_chain:
38
38
  aW9OckllMC8xNWRIcERvSUVESUxhNnpVNDZCClhEdHAxWXhkZVZHSUJ1Tm9Q
39
39
  MXZqRFN2TktZajBwTWpSQUVQcnFLMzlqS0U9Ci0tLS0tRU5EIENFUlRJRklD
40
40
  QVRFLS0tLS0K
41
- date: 2013-09-25 00:00:00.000000000 Z
41
+ date: 2013-10-18 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.1.3
90
+ rubygems_version: 2.1.5
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: A simple and solid concern to track ActiveRecord models attributes changes.
metadata.gz.sig CHANGED
Binary file