spira 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/VERSION +1 -1
- data/lib/spira/base.rb +15 -13
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba7c397f10839515753ca0a13c380959560193a2
|
4
|
+
data.tar.gz: b9feeb54d42235f5ab083febfd5f394c12cd8066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ecb09b4b0fa2e1b99f9d271a4d3c4000d9f6d9c5b591b7d7db08129ce225e253ea28964b5b923fc4f7e12a47dbca511e334fc3bf827d17578898f77b56586ef
|
7
|
+
data.tar.gz: 78d84e1dcdf5097b097d26297951646eff2b10ab3c8f09f08cbf80aa989b9fb35abc53434dcd6e35575d160ff896eb11572ed70780d957e30c6b6ef2bf63c978
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
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
|
-
@
|
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
|
-
@
|
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(
|
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
|
-
|
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
|
295
|
-
changed_attributes[name] =
|
296
|
-
|
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
|
-
|
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 =
|
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.
|
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-
|
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.
|
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.
|