Class: Factbase::Once

Inherits:
Object
  • Object
show all
Defined in:
lib/judges/fb/once.rb

Overview

Runs only once.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Defined Under Namespace

Classes: After

Instance Method Summary collapse

Constructor Details

#initialize(fb, func) ⇒ Once

Returns a new instance of Once.



33
34
35
36
# File 'lib/judges/fb/once.rb', line 33

def initialize(fb, func)
  @fb = fb
  @func = func
end

Instance Method Details

#insertObject



43
44
45
# File 'lib/judges/fb/once.rb', line 43

def insert
  @fb.insert
end

#query(expr) ⇒ Object



38
39
40
41
# File 'lib/judges/fb/once.rb', line 38

def query(expr)
  expr = "(and #{expr} (not (eq seen '#{@func}')))"
  After.new(@fb.query(expr), @func)
end