Class: Factbase::Looged

Inherits:
Object
  • Object
show all
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

Classes: Fact, Query

Instance Method Summary collapse

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

#dupObject



35
36
37
# File 'lib/factbase/looged.rb', line 35

def dup
  Factbase::Looged.new(@fb.dup, @loog)
end

#exportObject



57
58
59
# File 'lib/factbase/looged.rb', line 57

def export
  @fb.export
end

#import(bytes) ⇒ Object



61
62
63
# File 'lib/factbase/looged.rb', line 61

def import(bytes)
  @fb.import(bytes)
end

#insertObject



43
44
45
46
47
# File 'lib/factbase/looged.rb', line 43

def insert
  f = @fb.insert
  @loog.debug("Inserted new fact ##{@fb.size}")
  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

#sizeObject



39
40
41
# File 'lib/factbase/looged.rb', line 39

def size
  @fb.size
end

#txn(this = self) ⇒ Object



53
54
55
# File 'lib/factbase/looged.rb', line 53

def txn(this = self, &)
  @fb.txn(this, &)
end