spira 3.0.0 → 3.1.0

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 (4) hide show
  1. checksums.yaml +5 -5
  2. data/VERSION +1 -1
  3. data/lib/spira/base.rb +15 -13
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: f7be0c532c05d07639c5d973ebd4d499fae73c54413a8c9ef783a4bfd3bec09d
4
- data.tar.gz: f2d830691b77d1f9618c4114200a5322ae9bf010091d92a7b5ae02a1bbcf5077
2
+ SHA1:
3
+ metadata.gz: ba7c397f10839515753ca0a13c380959560193a2
4
+ data.tar.gz: b9feeb54d42235f5ab083febfd5f394c12cd8066
5
5
  SHA512:
6
- metadata.gz: 5d35397a4ab24e3a206f438e92eb81db0c0e552a384536f1c4de8bd2d8e308b34b6ecb770640ad69afd171f09f542b0d517ab2c0aee8b053271b0214d9384d68
7
- data.tar.gz: 2e5d28785bf4a8c50bea90a5f9b5572113e3775d0409e7c64705e39db3f99adb662b1c4aede300bb24f710af444957af0c25b6dab6bd05c4c63ea68df3efb04d
6
+ metadata.gz: 1ecb09b4b0fa2e1b99f9d271a4d3c4000d9f6d9c5b591b7d7db08129ce225e253ea28964b5b923fc4f7e12a47dbca511e334fc3bf827d17578898f77b56586ef
7
+ data.tar.gz: 78d84e1dcdf5097b097d26297951646eff2b10ab3c8f09f08cbf80aa989b9fb35abc53434dcd6e35575d160ff896eb11572ed70780d957e30c6b6ef2bf63c978
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.1.0
data/lib/spira/base.rb CHANGED
@@ -32,8 +32,6 @@ module Spira
32
32
  # @return [RDF::URI]
33
33
  attr_reader :subject
34
34
 
35
- attr_accessor :attributes
36
-
37
35
  class << self
38
36
  attr_reader :reflections, :properties
39
37
 
@@ -119,21 +117,26 @@ module Spira
119
117
  # @see RDF::Node#as
120
118
  def initialize(props = {}, options = {})
121
119
  @subject = props.delete(:_subject) || RDF::Node.new
120
+ @attrs = {}
122
121
 
123
- @attributes = {}
124
122
  reload props
125
123
 
126
124
  yield self if block_given?
127
125
  end
128
126
 
127
+ # Returns the attributes
128
+ def attributes
129
+ @attrs
130
+ end
131
+
129
132
  # Freeze the attributes hash such that associations are still accessible, even on destroyed records.
130
133
  def freeze
131
- @attributes.freeze; self
134
+ @attrs.freeze; self
132
135
  end
133
136
 
134
137
  # Returns +true+ if the attributes hash has been frozen.
135
138
  def frozen?
136
- @attributes.frozen?
139
+ @attrs.frozen?
137
140
  end
138
141
 
139
142
  ##
@@ -257,7 +260,7 @@ module Spira
257
260
  # @param [RDF::Resource] new_subject
258
261
  # @return [Spira::Base] copy
259
262
  def copy(new_subject)
260
- self.class.new(attributes.merge(:_subject => new_subject))
263
+ self.class.new(@attrs.merge(:_subject => new_subject))
261
264
  end
262
265
 
263
266
  ##
@@ -284,20 +287,19 @@ module Spira
284
287
  private
285
288
 
286
289
  def reset_changes
287
- @previously_changed = changes
288
- @changed_attributes.clear
290
+ clear_changes_information
289
291
  end
290
292
 
291
293
  def write_attribute(name, value)
292
294
  name = name.to_s
293
295
  if self.class.properties[name]
294
- if attributes[name].is_a?(Promise)
295
- changed_attributes[name] = attributes[name] unless changed_attributes.include?(name)
296
- attributes[name] = value
296
+ if @attrs[name].is_a?(Promise)
297
+ changed_attributes[name] = @attrs[name] unless changed_attributes.include?(name)
298
+ @attrs[name] = value
297
299
  else
298
300
  if value != read_attribute(name)
299
301
  attribute_will_change!(name)
300
- attributes[name] = value
302
+ @attrs[name] = value
301
303
  end
302
304
  end
303
305
  else
@@ -309,7 +311,7 @@ module Spira
309
311
  # Get the current value for the given attribute
310
312
  #
311
313
  def read_attribute(name)
312
- value = attributes[name.to_s]
314
+ value = @attrs[name.to_s]
313
315
 
314
316
  refl = self.class.reflections[name]
315
317
  if refl && !value
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spira
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Lavender
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir:
10
10
  - bin
11
11
  cert_chain: []
12
- date: 2018-01-08 00:00:00.000000000 Z
12
+ date: 2018-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  requirements: []
234
234
  rubyforge_project: spira
235
- rubygems_version: 2.7.3
235
+ rubygems_version: 2.6.14.1
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: A framework for using the information in RDF.rb repositories as model objects.