serialize_with_coder 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. data/lib/serialize_with_coder.rb +10 -2
  2. metadata +5 -5
@@ -36,7 +36,12 @@ module SerializeWithCoder
36
36
  end
37
37
 
38
38
  define_method("#{attr_name}_changed?") do
39
- class_name.load( read_attribute(attr_name) ) != send(attr_name)
39
+ if instance_variable_get("@#{attr_name}_rchanged")
40
+ instance_variable_set("@#{attr_name}_rchanged", nil)
41
+ true
42
+ else
43
+ class_name.load( read_attribute(attr_name) ) != send(attr_name)
44
+ end
40
45
  end
41
46
 
42
47
  define_method("#{attr_name}_change") do
@@ -53,7 +58,10 @@ module SerializeWithCoder
53
58
 
54
59
  define_method("synchronize_serialized_fields") do
55
60
  @@serialized_with_coder_fields.each do |column, coder|
56
- write_attribute(column, coder.dump( instance_variable_get("@#{column}") )) if send("#{column}_changed?")
61
+ if send("#{column}_changed?")
62
+ write_attribute(column, coder.dump( instance_variable_get("@#{column}") ))
63
+ instance_variable_set("@#{column}_rchanged", true)
64
+ end
57
65
  end
58
66
  end
59
67
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serialize_with_coder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Maciej Gajek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-15 00:00:00 +01:00
18
+ date: 2011-12-06 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  requirements: []
107
107
 
108
108
  rubyforge_project:
109
- rubygems_version: 1.5.0
109
+ rubygems_version: 1.4.2
110
110
  signing_key:
111
111
  specification_version: 3
112
112
  summary: Serialize with Coder