Class: Factbase::Rules
- Inherits:
-
Object
show all
- Defined in:
- lib/factbase/rules.rb
Overview
A decorator of a Factbase, that checks rules on every set.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Defined Under Namespace
Classes: Check, Fact, Query
Instance Method Summary
collapse
Constructor Details
#initialize(fb, rules) ⇒ Rules
Returns a new instance of Rules.
30
31
32
33
34
|
# File 'lib/factbase/rules.rb', line 30
def initialize(fb, rules)
@fb = fb
@rules = rules
@check = Check.new(fb, @rules)
end
|
Instance Method Details
#dup ⇒ Object
36
37
38
|
# File 'lib/factbase/rules.rb', line 36
def dup
Factbase::Rules.new(@fb.dup, @rules)
end
|
#export ⇒ Object
56
57
58
|
# File 'lib/factbase/rules.rb', line 56
def export
@fb.export
end
|
#import(bytes) ⇒ Object
60
61
62
|
# File 'lib/factbase/rules.rb', line 60
def import(bytes)
@fb.import(bytes)
end
|
#insert ⇒ Object
44
45
46
|
# File 'lib/factbase/rules.rb', line 44
def insert
Fact.new(@fb.insert, @check)
end
|
#query(query) ⇒ Object
48
49
50
|
# File 'lib/factbase/rules.rb', line 48
def query(query)
Query.new(@fb.query(query), @check)
end
|
#size ⇒ Object
40
41
42
|
# File 'lib/factbase/rules.rb', line 40
def size
@fb.size
end
|
#txn(this = self) ⇒ Object
52
53
54
|
# File 'lib/factbase/rules.rb', line 52
def txn(this = self, &)
@fb.txn(this, &)
end
|