activefacts-api 0.8.10 → 0.8.12

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.10
1
+ 0.8.12
@@ -0,0 +1,79 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "activefacts-api"
8
+ s.version = "0.8.12"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Clifford Heath"]
12
+ s.date = "2012-01-03"
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
+ s.email = "clifford.heath@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc",
18
+ "TODO"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "activefacts-api.gemspec",
28
+ "lib/activefacts/api.rb",
29
+ "lib/activefacts/api/constellation.rb",
30
+ "lib/activefacts/api/entity.rb",
31
+ "lib/activefacts/api/instance.rb",
32
+ "lib/activefacts/api/instance_index.rb",
33
+ "lib/activefacts/api/numeric.rb",
34
+ "lib/activefacts/api/object_type.rb",
35
+ "lib/activefacts/api/role.rb",
36
+ "lib/activefacts/api/role_values.rb",
37
+ "lib/activefacts/api/standard_types.rb",
38
+ "lib/activefacts/api/support.rb",
39
+ "lib/activefacts/api/value.rb",
40
+ "lib/activefacts/api/vocabulary.rb",
41
+ "lib/activefacts/tracer.rb",
42
+ "spec/autocounter_spec.rb",
43
+ "spec/constellation_spec.rb",
44
+ "spec/entity_type_spec.rb",
45
+ "spec/identification_spec.rb",
46
+ "spec/instance_spec.rb",
47
+ "spec/role_values_spec.rb",
48
+ "spec/roles_spec.rb",
49
+ "spec/spec_helper.rb",
50
+ "spec/value_type_spec.rb"
51
+ ]
52
+ s.homepage = "http://github.com/cjheath/activefacts-api"
53
+ s.licenses = ["MIT"]
54
+ s.require_paths = ["lib"]
55
+ s.rubygems_version = "1.8.10"
56
+ s.summary = "A fact-based data model DSL and API"
57
+
58
+ if s.respond_to? :specification_version then
59
+ s.specification_version = 3
60
+
61
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
63
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
65
+ s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
66
+ else
67
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
68
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
69
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
70
+ s.add_dependency(%q<rdoc>, [">= 2.4.2"])
71
+ end
72
+ else
73
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
74
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
75
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
76
+ s.add_dependency(%q<rdoc>, [">= 2.4.2"])
77
+ end
78
+ end
79
+
@@ -21,6 +21,10 @@ class Int < SimpleDelegator
21
21
  __getobj__.to_s
22
22
  end
23
23
 
24
+ def to_json c = {} #:nodoc
25
+ __getobj__.to_json
26
+ end
27
+
24
28
  def hash #:nodoc:
25
29
  __getobj__.hash
26
30
  end
@@ -60,6 +64,10 @@ class Real < SimpleDelegator
60
64
  __getobj__.to_s
61
65
  end
62
66
 
67
+ def to_json c = {} #:nodoc
68
+ __getobj__.to_json
69
+ end
70
+
63
71
  def eql?(o) #:nodoc:
64
72
  # Note: See the note above on Int#eql?
65
73
  __getobj__.eql?(Float(o))
@@ -122,7 +130,13 @@ end
122
130
  class AutoCounter
123
131
  def initialize(i = :new)
124
132
  raise "AutoCounter #{self.class} may not be #{i.inspect}" unless i == :new or i.is_a?(Integer) or i.is_a?(AutoCounter)
125
- @value = i == :new ? nil : i.to_i
133
+ @@placeholder ||= 0
134
+ if i == :new
135
+ @value = nil
136
+ @initially = (@@placeholder+=1)
137
+ else
138
+ @initially = @value = i.to_i;
139
+ end
126
140
  end
127
141
 
128
142
  # Assign a definite value to an AutoCounter; this may only be done once
@@ -140,7 +154,7 @@ class AutoCounter
140
154
  if self.defined?
141
155
  @value.to_s
142
156
  else
143
- "new_#{object_id}"
157
+ "new_#{@initially}"
144
158
  end
145
159
  end
146
160
 
@@ -5,6 +5,14 @@
5
5
  # Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
6
6
  #
7
7
 
8
+ # Define Infinity as a constant, if it's not already defined:
9
+ # We use this to define open-ended ranges.
10
+ begin
11
+ Object.const_get("Infinity")
12
+ rescue
13
+ Infinity = 1.0/0.0
14
+ end
15
+
8
16
  class Symbol #:nodoc:
9
17
  def to_proc
10
18
  Proc.new{|*args| args.shift.__send__(self, *args)}
@@ -264,16 +264,12 @@ describe "A Constellation instance" do
264
264
  it "should handle one-to-ones correctly" do
265
265
  person = @constellation.Person "Fred", "Smith", :auto_counter_value => :new, :birth_name => "Nerk"
266
266
 
267
- pending "Extra parameters on an assert get processed in Role#adapt before @constellation gets set" do
268
- #person.birth_name = "Nerk"
269
-
270
- nerk = @constellation.Name["Nerk"]
271
- nerk.should_not be_nil
272
- nerk.person_as_birth_name.should == person
273
- person.birth_name = nil
274
- nerk.person_as_birth_name.should be_nil
275
- @constellation.Name["Nerk"].should_not be_nil
276
- end
267
+ nerk = @constellation.Name["Nerk"]
268
+ nerk.should_not be_nil
269
+ nerk.person_as_birth_name.should == person
270
+ person.birth_name = nil
271
+ nerk.person_as_birth_name.should be_nil
272
+ @constellation.Name["Nerk"].should_not be_nil
277
273
  end
278
274
 
279
275
  it "should allow retraction of instances" do
metadata CHANGED
@@ -1,110 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activefacts-api
3
- version: !ruby/object:Gem::Version
4
- hash: 43
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.12
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 8
9
- - 10
10
- version: 0.8.10
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Clifford Heath
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-06-27 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70247315177760 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 2
31
- - 3
32
- - 0
20
+ - !ruby/object:Gem::Version
33
21
  version: 2.3.0
34
22
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: bundler
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70247315177760
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &70247315159600 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 23
45
- segments:
46
- - 1
47
- - 0
48
- - 0
31
+ - !ruby/object:Gem::Version
49
32
  version: 1.0.0
50
33
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: jeweler
54
34
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70247315159600
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &70247315158800 !ruby/object:Gem::Requirement
56
39
  none: false
57
- requirements:
40
+ requirements:
58
41
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 7
61
- segments:
62
- - 1
63
- - 5
64
- - 2
42
+ - !ruby/object:Gem::Version
65
43
  version: 1.5.2
66
44
  type: :development
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rdoc
70
45
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70247315158800
47
+ - !ruby/object:Gem::Dependency
48
+ name: rdoc
49
+ requirement: &70247315158320 !ruby/object:Gem::Requirement
72
50
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 27
77
- segments:
78
- - 2
79
- - 4
80
- - 2
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
81
54
  version: 2.4.2
82
55
  type: :development
83
- version_requirements: *id004
84
- description: |
85
-
56
+ prerelease: false
57
+ version_requirements: *70247315158320
58
+ description: ! '
59
+
86
60
  The ActiveFacts API is a Ruby DSL for managing constellations of elementary facts.
87
- Each fact is either existential (a value or an entity), characteristic (boolean) or
88
- binary relational (A rel B). Relational facts are consistently co-referenced, so you
61
+
62
+ Each fact is either existential (a value or an entity), characteristic (boolean)
63
+ or
64
+
65
+ binary relational (A rel B). Relational facts are consistently co-referenced, so
66
+ you
67
+
89
68
  can traverse them efficiently in any direction. Each constellation maintains constraints
69
+
90
70
  over the fact population.
91
71
 
72
+ '
92
73
  email: clifford.heath@gmail.com
93
74
  executables: []
94
-
95
75
  extensions: []
96
-
97
- extra_rdoc_files:
76
+ extra_rdoc_files:
98
77
  - LICENSE.txt
99
78
  - README.rdoc
100
79
  - TODO
101
- files:
80
+ files:
102
81
  - .document
103
82
  - .rspec
104
83
  - LICENSE.txt
105
84
  - README.rdoc
106
85
  - Rakefile
107
86
  - VERSION
87
+ - activefacts-api.gemspec
108
88
  - lib/activefacts/api.rb
109
89
  - lib/activefacts/api/constellation.rb
110
90
  - lib/activefacts/api/entity.rb
@@ -130,37 +110,28 @@ files:
130
110
  - spec/value_type_spec.rb
131
111
  - TODO
132
112
  homepage: http://github.com/cjheath/activefacts-api
133
- licenses:
113
+ licenses:
134
114
  - MIT
135
115
  post_install_message:
136
116
  rdoc_options: []
137
-
138
- require_paths:
117
+ require_paths:
139
118
  - lib
140
- required_ruby_version: !ruby/object:Gem::Requirement
119
+ required_ruby_version: !ruby/object:Gem::Requirement
141
120
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- hash: 3
146
- segments:
147
- - 0
148
- version: "0"
149
- required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
126
  none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- hash: 3
155
- segments:
156
- - 0
157
- version: "0"
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
158
131
  requirements: []
159
-
160
132
  rubyforge_project:
161
- rubygems_version: 1.8.5
133
+ rubygems_version: 1.8.10
162
134
  signing_key:
163
135
  specification_version: 3
164
136
  summary: A fact-based data model DSL and API
165
137
  test_files: []
166
-