active_data 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afec00097f73eb4a4e675f3f441c7c683b11b334dedec7eebc48670622770b50
4
- data.tar.gz: afc5306ef42e04ff6c987a2e17065f8b7712dffef2975221296a1810b7501d78
3
+ metadata.gz: 8fd00914914806d951a6e19e1927d9256d681c3af5b2125b67e06b3d90ad368f
4
+ data.tar.gz: ceeb1a7d53206a65d045d7a46017d261a0d872aa384bdebc7f11f4500861226d
5
5
  SHA512:
6
- metadata.gz: 252757a6370421a428859eb88a88edd081683d5a7cb78f7e28cae40dff56681e2b5f4b9d37c438d6ba9959014259234fa6c2dc4d6325d2c2801718b1cd253f9c
7
- data.tar.gz: a8c9449f1236d9b35e7e665c2f164a50635e5cdb2a3e8fbd6b5e803b422069b7589f6c380a424f64e2b629966a4c0bc0376774e68fc9c62e7199447daec249f5
6
+ metadata.gz: 995f37a727c0815e131189133c31a8bb767f7001fecef437305e81723c11ec25f54884cc50411fb34e53d213fb7482298af8ac2d576e51da68044fb2deb287e5
7
+ data.tar.gz: e9609fb34fba1628e4bc3d341378c2fea985fa021b2463ed61d5f9b2b9ae997315d07a54de516402459b2dc51dffc66076f1e64a492021895b507c3770330d58
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # master
2
2
 
3
+ # Version 1.1.4
4
+
5
+ ## Changes
6
+
7
+ * `came_from_default?` attribute method (#66)
8
+
3
9
  # Version 1.1.3
4
10
 
5
11
  ## Changes
@@ -42,6 +42,10 @@ module ActiveData
42
42
  @origin == :user
43
43
  end
44
44
 
45
+ def came_from_default?
46
+ @origin == :default
47
+ end
48
+
45
49
  def value_present?
46
50
  !read.nil? && !(read.respond_to?(:empty?) && read.empty?)
47
51
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveData
2
- VERSION = '1.1.3'.freeze
2
+ VERSION = '1.1.4'.freeze
3
3
  end
@@ -45,6 +45,14 @@ describe ActiveData::Model::Attributes::Base do
45
45
  specify { expect(field.tap { |r| r.write('value') }.came_from_user?).to eq(true) }
46
46
  end
47
47
 
48
+ describe '#came_from_default?' do
49
+ let(:field) { attribute(type: String, default: 'world') }
50
+ let(:object) { Object.new }
51
+
52
+ specify { expect(field.came_from_default?).to eq(true) }
53
+ specify { expect(field.tap { |r| r.write('value') }.came_from_default?).to eq(false) }
54
+ end
55
+
48
56
  describe '#value_present?' do
49
57
  let(:field) { attribute }
50
58
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyromaniac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-21 00:00:00.000000000 Z
11
+ date: 2019-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -333,8 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  - !ruby/object:Gem::Version
334
334
  version: '0'
335
335
  requirements: []
336
- rubyforge_project:
337
- rubygems_version: 2.7.6
336
+ rubygems_version: 3.0.3
338
337
  signing_key:
339
338
  specification_version: 4
340
339
  summary: Working with hashes in AR style