Class: Fbe::Conclude

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

Overview

Conclude.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2024 Zerocracy

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(fb, judge, loog) ⇒ Conclude

Returns a new instance of Conclude.



39
40
41
42
43
44
45
46
47
# File 'lib/fbe/conclude.rb', line 39

def initialize(fb, judge, loog)
  @fb = fb
  @judge = judge
  @loog = loog
  @query = nil
  @follows = []
  @threshold = 9999
  @quota_aware = false
end

Instance Method Details

#considerObject



82
83
84
85
86
87
# File 'lib/fbe/conclude.rb', line 82

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

#drawObject



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

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

#follow(props) ⇒ Object



62
63
64
# File 'lib/fbe/conclude.rb', line 62

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

#maybeObject



74
75
76
77
78
79
80
# File 'lib/fbe/conclude.rb', line 74

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

#on(query) ⇒ Object



53
54
55
56
# File 'lib/fbe/conclude.rb', line 53

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

#quota_awareObject



49
50
51
# File 'lib/fbe/conclude.rb', line 49

def quota_aware
  @quota_aware = true
end

#threshold(max) ⇒ Object



58
59
60
# File 'lib/fbe/conclude.rb', line 58

def threshold(max)
  @threshold = max
end