class Fbe::Award

License
MIT
Copyright
Copyright © 2024 Yegor Bugayenko
Author

Yegor Bugayenko (yegor256@gmail.com)
puts p.markdown # Markdown of the bylaw
p = a.bylaw
Or else, you can get a bylaw text:
puts b.greeting # how to explain the reward, a text
puts b.points # how many points to reward, a number
b = a.bill(loc: 345)
Then, you can either get a bill from it:
a = Fbe::Award.new(‘(award (in loc “lines”) (give (times loc 5) “for LoC”))’)
require ‘fbe/award’
we use in queries to a Factbase, for example:
First, you should create a bylaw, using the same Lisp-ish syntax as
A generator of awards.

def bill(vars = {})

Returns:
  • (Fbe::Award::Bill) - The bill

Parameters:
  • vars (Hash) -- Hash of variables
def bill(vars = {})
  term = Factbase::Syntax.new(@query).to_term
  term.redress!(Fbe::Award::BTerm)
  bill = Bill.new
  vars.each { |k, v| bill.set(k, v) }
  term.bill_to(bill)
  bill
end

def bylaw

Returns:
  • (Fbe::Award::Bylaw) - The bylaw
def bylaw
  term = Factbase::Syntax.new(@query).to_term
  term.redress!(Fbe::Award::PTerm)
  bylaw = Bylaw.new
  term.publish_to(bylaw)
  bylaw
end

def initialize(query = nil, judge: $judge, global: $global, options: $options, loog: $loog)

Parameters:
  • judge (String) -- The name of the judge
  • query (String) -- The query with the bylaw
def initialize(query = nil, judge: $judge, global: $global, options: $options, loog: $loog)
  query = Fbe.pmp(fb: Fbe.fb, global:, options:, loog:).hr.send(judge.tr('-', '_')) if query.nil?
  @query = query
end