Class: Factbase::Inv
- Inherits:
-
Object
- Object
- Factbase::Inv
- Defined in:
- lib/factbase/inv.rb
Overview
A decorator of a Factbase, that checks invariants on every set.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Defined Under Namespace
Instance Method Summary collapse
- #dup ⇒ Object
-
#initialize(fb, &block) ⇒ Inv
constructor
A new instance of Inv.
- #insert ⇒ Object
- #query(query) ⇒ Object
- #txn(this = self) ⇒ Object
Constructor Details
#initialize(fb, &block) ⇒ Inv
Returns a new instance of Inv.
34 35 36 37 |
# File 'lib/factbase/inv.rb', line 34 def initialize(fb, &block) @fb = fb @block = block end |
Instance Method Details
#dup ⇒ Object
39 40 41 |
# File 'lib/factbase/inv.rb', line 39 def dup Factbase::Inv.new(@fb.dup, &@block) end |
#insert ⇒ Object
43 44 45 |
# File 'lib/factbase/inv.rb', line 43 def insert Fact.new(@fb.insert, @block) end |
#query(query) ⇒ Object
47 48 49 |
# File 'lib/factbase/inv.rb', line 47 def query(query) Query.new(@fb.query(query), @block) end |
#txn(this = self) ⇒ Object
51 52 53 |
# File 'lib/factbase/inv.rb', line 51 def txn(this = self, &) @fb.txn(this, &) end |