Class: Fbe::Conclude

Inherits:
Object
  • Object
show all
Defined in:
lib/fbe/conclude.rb

Overview

Conclude.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2024 Zerocracy

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(fb:, judge:, global:, options:, loog:) ⇒ Conclude

Ctor.

Parameters:

  • fb (Factbase)

    The factbase

  • judge (String)

    The name of the judge, from the judges tool

  • global (Hash)

    The hash for global caching

  • options (Judges::Options)

    The options coming from the judges tool

  • loog (Loog)

    The logging facility



54
55
56
57
58
59
60
61
62
63
# File 'lib/fbe/conclude.rb', line 54

def initialize(fb:, judge:, global:, options:, loog:)
  @fb = fb
  @judge = judge
  @loog = loog
  @options = options
  @global = global
  @query = nil
  @follows = []
  @quota_aware = false
end

Instance Method Details

#considerObject



94
95
96
97
98
99
# File 'lib/fbe/conclude.rb', line 94

def consider(&)
  roll do |_fbt, a|
    yield a
    nil
  end
end

#drawObject



78
79
80
81
82
83
84
# File 'lib/fbe/conclude.rb', line 78

def draw(&)
  roll do |fbt, a|
    n = fbt.insert
    fill(n, a, &)
    n
  end
end

#follow(props) ⇒ Object



74
75
76
# File 'lib/fbe/conclude.rb', line 74

def follow(props)
  @follows = props.split
end

#maybeObject



86
87
88
89
90
91
92
# File 'lib/fbe/conclude.rb', line 86

def maybe(&)
  roll do |fbt, a|
    Fbe.if_absent(fb: fbt) do |n|
      fill(n, a, &)
    end
  end
end

#on(query) ⇒ Object



69
70
71
72
# File 'lib/fbe/conclude.rb', line 69

def on(query)
  raise 'Query is already set' unless @query.nil?
  @query = query
end

#quota_awareObject



65
66
67
# File 'lib/fbe/conclude.rb', line 65

def quota_aware
  @quota_aware = true
end