active_type 0.4.1 → 0.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 873fb9515c20f974ad20b3cd2b8f4fd787aa9649
4
- data.tar.gz: 9fd4f0f639d4189fcd82778d94a63315733376a8
3
+ metadata.gz: 68b30f74cacafd71c8c3cdeb7a16f0819bbe5826
4
+ data.tar.gz: 347ebc899df117c5265c505aec13bb6f77a4f82b
5
5
  SHA512:
6
- metadata.gz: f6f51d7a8632c8701c5a1dc100aeadd769c0e646774533b3b4c459139eaa81a6144fca448d242c9da75dbb5968f1e2ef8a8eda034836a8b942ff6eb567bd0d2e
7
- data.tar.gz: 1a581ee2b4c8dbab6f9d3be522f7a256b877dff9c1a98e7bef1ef294e4a154d48cbd09acc790425d73aa4844865b8902e90d82c520da6638094da1a58d7ba81e
6
+ metadata.gz: c13099db232d67a515d3a2a417d2bf3a95549ca69a9772a27e128fef1dffaa20caae45990b16a16ee3745482c11f7b58a737075ba97284057ea6b476fbdbb4ae
7
+ data.tar.gz: 23b0da781115e740380532c8092abb3bb74d175e99b56b7d46cdb9fec82e4161568794d95505ce4582822935c1d38d5c5f9a562b25b8ca97258aee7ede110009
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.4.0)
4
+ active_type (0.4.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.4.0)
4
+ active_type (0.4.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.4.0)
4
+ active_type (0.4.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.4.0)
4
+ active_type (0.4.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.4.0)
4
+ active_type (0.4.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module ActiveType
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -40,8 +40,7 @@ module ActiveType
40
40
  add_virtual_column(name, type, options)
41
41
  build_reader(name)
42
42
  build_writer(name)
43
- build_value_was_method(name)
44
- build_value_changed_method(name)
43
+ build_dirty_tracking_methods(name)
45
44
  end
46
45
 
47
46
  private
@@ -72,20 +71,25 @@ module ActiveType
72
71
  BODY
73
72
  end
74
73
 
75
- def build_value_was_method(name)
74
+ # Methods for compatibility with gems expecting the ActiveModel::Dirty API.
75
+ def build_dirty_tracking_methods(name)
76
76
  @module.module_eval <<-BODY, __FILE__, __LINE__ + 1
77
77
  def #{name}_was
78
78
  nil
79
79
  end
80
80
  BODY
81
- end
82
81
 
83
- def build_value_changed_method(name)
84
82
  @module.module_eval <<-BODY, __FILE__, __LINE__ + 1
85
83
  def #{name}_changed?
86
84
  not #{name}.nil?
87
85
  end
88
86
  BODY
87
+
88
+ @module.module_eval <<-BODY, __FILE__, __LINE__ + 1
89
+ def #{name}_will_change!
90
+ # no-op
91
+ end
92
+ BODY
89
93
  end
90
94
 
91
95
  def validate_attribute_name!(name)
@@ -28,4 +28,13 @@ shared_examples_for "a class supporting dirty tracking for virtual attributes" d
28
28
 
29
29
  end
30
30
 
31
+ describe '#virtual_attribute_will_change!' do
32
+
33
+ it 'is implemented for compatibility with ActiveModel::Dirty, but does nothing' do
34
+ subject.should respond_to(:virtual_attribute_will_change!)
35
+ expect { subject.virtual_attribute_will_change! }.to_not raise_error
36
+ end
37
+
38
+ end
39
+
31
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze