bmg 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bmg/relation.rb +1 -2
- data/lib/bmg/type.rb +10 -4
- data/lib/bmg/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2b2153bc229ff1517982db773316de847812ac3
|
4
|
+
data.tar.gz: 9f9b558de99c868d0b8dd5d8e11eb649fca7e1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46d9fe457281dcee1cc202b341fc98a8dbb55a4b5a1c1fc8cf7163bc4c5694149d2697b55736c112d4583596cc8d1b353f8c4f1144475ef2fe7d7d79deb3047
|
7
|
+
data.tar.gz: 4ed985da29e10309920a3a8866aff6f2d21014e23ee023a695cc4105f6d740ab62c4b87cc72f9157aa98bfc06b0c5e2c1f8dd98f8554e1e605fe27e8b1f1ba43
|
data/lib/bmg/relation.rb
CHANGED
@@ -9,6 +9,7 @@ module Bmg
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.empty(type = Type::ANY)
|
12
|
+
raise ArgumentError, "Missing type" if type.nil?
|
12
13
|
Relation::Empty.new(type)
|
13
14
|
end
|
14
15
|
|
@@ -95,5 +96,3 @@ module Bmg
|
|
95
96
|
|
96
97
|
end # module Relation
|
97
98
|
end # module Bmg
|
98
|
-
require_relative 'relation/empty'
|
99
|
-
require_relative 'relation/in_memory'
|
data/lib/bmg/type.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
module Bmg
|
2
2
|
class Type
|
3
3
|
|
4
|
+
def initialize(predicate = Predicate.tautology)
|
5
|
+
@predicate = predicate
|
6
|
+
raise ArgumentError if @predicate.nil?
|
7
|
+
end
|
8
|
+
attr_reader :predicate
|
9
|
+
|
4
10
|
ANY = Type.new
|
5
11
|
|
6
12
|
def [](attribute)
|
@@ -20,7 +26,7 @@ module Bmg
|
|
20
26
|
end
|
21
27
|
|
22
28
|
def constants(cs)
|
23
|
-
|
29
|
+
Type.new(@predicate & Predicate.eq(cs))
|
24
30
|
end
|
25
31
|
|
26
32
|
def extend(extension)
|
@@ -36,15 +42,15 @@ module Bmg
|
|
36
42
|
end
|
37
43
|
|
38
44
|
def rename(renaming)
|
39
|
-
|
45
|
+
Type.new(@predicate.rename(renaming))
|
40
46
|
end
|
41
47
|
|
42
48
|
def restrict(predicate)
|
43
|
-
|
49
|
+
Type.new(@predicate & predicate)
|
44
50
|
end
|
45
51
|
|
46
52
|
def union(other)
|
47
|
-
|
53
|
+
Type.new(@predicate | other.predicate)
|
48
54
|
end
|
49
55
|
|
50
56
|
end # class Type
|
data/lib/bmg/version.rb
CHANGED