activefacts-api 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/activefacts-api.gemspec +2 -2
- data/lib/activefacts/api/entity.rb +3 -2
- data/lib/activefacts/api/instance.rb +1 -1
- data/lib/activefacts/api/instance_index.rb +2 -14
- data/spec/constellation/instance_index_spec.rb +1 -1
- data/spec/constellation/instance_spec.rb +1 -1
- data/spec/object_type/entity_type/multipart_identification_spec.rb +4 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.5
|
data/activefacts-api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "activefacts-api"
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Clifford Heath"]
|
12
|
-
s.date = "2013-01-
|
12
|
+
s.date = "2013-01-16"
|
13
13
|
s.description = "\nThe ActiveFacts API is a Ruby DSL for managing constellations of elementary facts.\nEach fact is either existential (a value or an entity), characteristic (boolean) or\nbinary relational (A rel B). Relational facts are consistently co-referenced, so you\ncan traverse them efficiently in any direction. Each constellation maintains constraints\nover the fact population.\n"
|
14
14
|
s.email = "clifford.heath@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -205,7 +205,7 @@ module ActiveFacts
|
|
205
205
|
next if existing_value == new_key # This can happen when the counterpart is a value type
|
206
206
|
|
207
207
|
existing_key = existing_value.identifying_role_values
|
208
|
-
next if existing_key
|
208
|
+
next if existing_key == new_key
|
209
209
|
raise TypeConflictException.new(basename, supertype, new_key, existing_key)
|
210
210
|
end
|
211
211
|
end
|
@@ -266,7 +266,8 @@ module ActiveFacts
|
|
266
266
|
end
|
267
267
|
elsif proto
|
268
268
|
value = proto.send(n)
|
269
|
-
|
269
|
+
value = value.identifying_role_values
|
270
|
+
arg_hash[n] = value # Save the value for making a new instance
|
270
271
|
next value if (role.is_unary)
|
271
272
|
else
|
272
273
|
value = nil
|
@@ -46,7 +46,7 @@ module ActiveFacts
|
|
46
46
|
if last_irns != irns
|
47
47
|
last_identity = identifying_role_values(klass)
|
48
48
|
role_position = irns.index(role.name)
|
49
|
-
last_identity[role_position] = value
|
49
|
+
last_identity[role_position] = value.identifying_role_values
|
50
50
|
end
|
51
51
|
@constellation.instances[klass][last_identity]
|
52
52
|
end
|
@@ -4,7 +4,6 @@
|
|
4
4
|
#
|
5
5
|
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
|
6
6
|
#
|
7
|
-
|
8
7
|
require 'forwardable'
|
9
8
|
|
10
9
|
module ActiveFacts
|
@@ -35,28 +34,17 @@ module ActiveFacts
|
|
35
34
|
end
|
36
35
|
|
37
36
|
def []=(key, value) #:nodoc:
|
38
|
-
@hash[
|
37
|
+
@hash[key] = value
|
39
38
|
end
|
40
39
|
|
41
40
|
def [](key)
|
42
|
-
@hash[
|
41
|
+
@hash[key]
|
43
42
|
end
|
44
43
|
|
45
44
|
def refresh_key(key)
|
46
45
|
value = @hash.delete(key)
|
47
46
|
@hash[value.identifying_role_values] = value if value
|
48
47
|
end
|
49
|
-
|
50
|
-
private
|
51
|
-
def flatten_key(key)
|
52
|
-
if key.is_a?(Array)
|
53
|
-
key.map { |identifier| flatten_key(identifier) }
|
54
|
-
elsif key.respond_to?(:identifying_role_values)
|
55
|
-
key.identifying_role_values
|
56
|
-
else
|
57
|
-
key
|
58
|
-
end
|
59
|
-
end
|
60
48
|
end
|
61
49
|
end
|
62
50
|
end
|
@@ -51,7 +51,7 @@ describe ActiveFacts::API::InstanceIndex do
|
|
51
51
|
|
52
52
|
describe "#flatten_key" do
|
53
53
|
it "should use identifying role values when using an entity type" do
|
54
|
-
@constellation.EntityA[@a].should == @a
|
54
|
+
@constellation.EntityA[@a.identifying_role_values].should == @a
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should recursively try to use identifying role values within an array" do
|
@@ -171,7 +171,7 @@ describe "An instance of every type of ObjectType" do
|
|
171
171
|
@test_by_date_time_entity = @constellation.TestByDateTimeEntity(@test_by_date_time)
|
172
172
|
@test_by_decimal_entity = @constellation.TestByDecimalEntity(@test_by_decimal)
|
173
173
|
@test_by_guid_entity = @constellation.TestByGuidEntity(@test_by_guid)
|
174
|
-
@constellation.TestByGuidEntity[[@test_by_guid]].should_not be_nil
|
174
|
+
@constellation.TestByGuidEntity[[@test_by_guid.identifying_role_values]].should_not be_nil
|
175
175
|
|
176
176
|
# Entity subtypes
|
177
177
|
@test_sub_by_int = @constellation.TestSubByInt(2*2)
|
@@ -31,9 +31,10 @@ describe "Multi-part identifiers" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should allow children to be found in the instance index" do
|
34
|
-
@
|
35
|
-
@c.Child[[
|
36
|
-
@c.Child[[
|
34
|
+
pv = @p.identifying_role_values
|
35
|
+
@c.Child[[pv, 0]].should == @c0
|
36
|
+
@c.Child[[pv, 1]].should == @c1
|
37
|
+
@c.Child[[pv, 2]].should == @c2
|
37
38
|
end
|
38
39
|
|
39
40
|
it "should sort child keys in the instance index" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activefacts-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -255,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
255
|
version: '0'
|
256
256
|
segments:
|
257
257
|
- 0
|
258
|
-
hash:
|
258
|
+
hash: 1210306376532031473
|
259
259
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
260
|
none: false
|
261
261
|
requirements:
|