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.
For example, you can use this decorator if you want to check that every fact has when
:
fb = Factbase::Inv.new(Factbase.new) do |f, fbt|
assert !f['when'].nil?
end
The second argument passed to the block is the factbase, while the first one is the fact just touched.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024-2025 Yegor Bugayenko
- License
-
MIT
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(fb, &block) ⇒ Inv
constructor
A new instance of Inv.
- #insert ⇒ Object
- #query(query, maps = nil) ⇒ Object
- #txn ⇒ Object
Constructor Details
#initialize(fb, &block) ⇒ Inv
Returns a new instance of Inv.
28 29 30 31 |
# File 'lib/factbase/inv.rb', line 28 def initialize(fb, &block) @fb = fb @block = block end |