Class: Judges::Once

Inherits:
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.



35
36
37
38
# File 'lib/judges/fb/once.rb', line 35

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

Instance Method Details

#insertObject



45
46
47
# File 'lib/judges/fb/once.rb', line 45

def insert
  @fb.insert
end

#query(expr) ⇒ Object



40
41
42
43
# File 'lib/judges/fb/once.rb', line 40

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