Module: Alf::Relvar
Defined Under Namespace
Classes: Base, Fake, ReadOnly, Virtual
Instance Attribute Summary collapse
Instance Method Summary
collapse
new
def_renderer_method, #to_a, #to_array
#!~, #&, #*, #+, #-, #=~, def_operator_method, #tuple_extract
def_aggregator_method
#attr_list, coerce, #heading, #keys, #resulting_type, #to_ascii_tree, #to_cog, #type_check
Instance Attribute Details
#expr ⇒ Object
Returns the value of attribute expr.
10
11
12
|
# File 'lib/alf/relvar.rb', line 10
def expr
@expr
end
|
Instance Method Details
#affect(value) ⇒ Object
50
51
52
53
|
# File 'lib/alf/relvar.rb', line 50
def affect(value)
delete
insert(value)
end
|
#delete(predicate = Predicate.tautology) ⇒ Object
#each(&bl) ⇒ Object
23
24
25
|
# File 'lib/alf/relvar.rb', line 23
def each(&bl)
to_cog.each(&bl)
end
|
#empty!(msg = "relvar is empty") ⇒ Object
32
33
34
35
|
# File 'lib/alf/relvar.rb', line 32
def empty!(msg = "relvar is empty")
raise FactAssertionError, msg unless empty?
self
end
|
#empty? ⇒ Boolean
27
28
29
30
|
# File 'lib/alf/relvar.rb', line 27
def empty?
to_cog.each{|_| return false }
true
end
|
#initialize(expr = nil) ⇒ Object
7
8
9
|
# File 'lib/alf/relvar.rb', line 7
def initialize(expr = nil)
@expr = expr
end
|
#insert(tuples) ⇒ Object
55
56
57
|
# File 'lib/alf/relvar.rb', line 55
def insert(tuples)
raise NotSupportedError
end
|
#not_empty!(msg = "relvar is not empty") ⇒ Object
37
38
39
40
|
# File 'lib/alf/relvar.rb', line 37
def not_empty!(msg = "relvar is not empty")
raise FactAssertionError, msg if empty?
self
end
|
#safe(*args, &bl) ⇒ Object
71
72
73
|
# File 'lib/alf/relvar.rb', line 71
def safe(*args, &bl)
Safe.new(self, *args, &bl)
end
|
#to_relation ⇒ Object
79
80
81
|
# File 'lib/alf/relvar.rb', line 79
def to_relation
to_cog.to_relation
end
|
#to_relvar ⇒ Object
75
76
77
|
# File 'lib/alf/relvar.rb', line 75
def to_relvar
self
end
|
#type ⇒ Object
17
18
19
|
# File 'lib/alf/relvar.rb', line 17
def type
@type ||= Relation[heading]
end
|
#update(updating, predicate = Predicate.tautology) ⇒ Object
#upsert(tuples) ⇒ Object
67
68
69
|
# File 'lib/alf/relvar.rb', line 67
def upsert(tuples)
empty? ? insert(tuples) : update(tuples)
end
|
#value ⇒ Object
42
43
44
|
# File 'lib/alf/relvar.rb', line 42
def value
to_relation
end
|