Class: Factbase::Looged
- Inherits:
-
Object
- Object
- Factbase::Looged
- Defined in:
- lib/factbase/looged.rb
Overview
A decorator of a Factbase, that logs all operations.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Defined Under Namespace
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #export ⇒ Object
- #import(bytes) ⇒ Object
-
#initialize(fb, loog) ⇒ Looged
constructor
A new instance of Looged.
- #insert ⇒ Object
- #query(query) ⇒ Object
- #size ⇒ Object
- #to_json(opt = nil) ⇒ Object
- #to_xml ⇒ Object
- #to_yaml ⇒ Object
Constructor Details
#initialize(fb, loog) ⇒ Looged
Returns a new instance of Looged.
30 31 32 33 |
# File 'lib/factbase/looged.rb', line 30 def initialize(fb, loog) @fb = fb @loog = loog end |
Instance Method Details
#empty? ⇒ Boolean
35 36 37 |
# File 'lib/factbase/looged.rb', line 35 def empty? @fb.empty? end |
#export ⇒ Object
53 54 55 |
# File 'lib/factbase/looged.rb', line 53 def export @fb.export end |
#import(bytes) ⇒ Object
57 58 59 |
# File 'lib/factbase/looged.rb', line 57 def import(bytes) @fb.import(bytes) end |
#insert ⇒ Object
43 44 45 46 47 |
# File 'lib/factbase/looged.rb', line 43 def insert f = @fb.insert @loog.debug('Inserted new fact') Fact.new(f, @loog) end |
#query(query) ⇒ Object
49 50 51 |
# File 'lib/factbase/looged.rb', line 49 def query(query) Query.new(@fb.query(query), query, @loog) end |
#size ⇒ Object
39 40 41 |
# File 'lib/factbase/looged.rb', line 39 def size @fb.size end |
#to_json(opt = nil) ⇒ Object
61 62 63 |
# File 'lib/factbase/looged.rb', line 61 def to_json(opt = nil) @fb.to_json(opt) end |
#to_xml ⇒ Object
65 66 67 |
# File 'lib/factbase/looged.rb', line 65 def to_xml @fb.to_xml end |
#to_yaml ⇒ Object
69 70 71 |
# File 'lib/factbase/looged.rb', line 69 def to_yaml @fb.to_yaml end |