active_fedora-registered_attributes 0.0.5 → 0.0.6

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
  SHA1:
3
- metadata.gz: a1756c151adf167f02b7a6b31deba661e7b84c66
4
- data.tar.gz: 37e4c184025058ac8b3cc3ad1230350caa175ab6
3
+ metadata.gz: 75df440b7dde330695f9cf1398b481e261b066f7
4
+ data.tar.gz: 041e953410c3ab4231ce3a29cddda5669ea3cfbe
5
5
  SHA512:
6
- metadata.gz: 53f179779e1e5de46e1033ddb603a6fb74afaa08b9fc6b823ed6dcb0253748d170d2cc1976492cf4c4a8a6d0692da810e1982e8fd8759bafd5eed9a134666968
7
- data.tar.gz: 60f3f297a80e959a68edc97d05eca788c4d6e7ea547b3be3d7ad0af2773a7bacbb39d6319c5d27b96157d029f92f5e3b13c98872183ab9a3a010b7386ff93439
6
+ metadata.gz: c789ab0d0f9cbfd99a7560ccb355e0053794681fe60d7f404cad88355116ac510863d5dd017a45c43b6f3305c9907b18fde798713e30c6525506d028c8f64f38
7
+ data.tar.gz: e729fdc5b4bb38949da5c723138d31516a2877973805713723a207257397ac1ebd5a635328aa9ec4b6e70d88284701c5624a3e7a48167f2513f318125c2bd770
@@ -44,26 +44,20 @@ module ActiveFedora
44
44
  end
45
45
  end
46
46
 
47
-
48
- # Applies the attribute defaults
49
- #
50
- # Applies all the default values to any attributes not yet set, avoiding
51
- # any attribute setter logic, such as dirty tracking.
52
- #
53
- # @param [Hash{String => Object}, #each] defaults The defaults to apply
54
- def apply_defaults(defaults=attribute_defaults)
55
- defaults.each do |name, value|
56
- unless value.nil?
57
- send("#{name}=", value) unless send("#{name}").present?
58
- end
59
- end
60
- end
61
-
62
47
  # Applies attribute default values
63
48
  def initialize(*)
64
49
  super
65
50
  apply_defaults
66
51
  end
67
52
 
53
+ protected
54
+ def apply_defaults(defaults=attribute_defaults)
55
+ defaults.each do |name, value|
56
+ if !value.nil? && !persisted?
57
+ send("#{name}=", value) # unless send("#{name}").present?
58
+ end
59
+ end
60
+ end
68
61
  end
62
+
69
63
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveFedora
2
2
  module RegisteredAttributes
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -147,7 +147,7 @@ describe ActiveFedora::RegisteredAttributes::Attribute do
147
147
 
148
148
  describe 'without datastream and skipping accessor' do
149
149
  let(:options) { {datastream: nil, skip_accessor: true} }
150
- it 'does not yield accession options' do
150
+ it 'does not yield accession options_for_input' do
151
151
  @yielded = false
152
152
  puts subject.send(:options)
153
153
  subject.with_accession_options {|name,opts|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_fedora-registered_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-31 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora