Class: Fbe::Award
- Inherits:
-
Object
- Object
- Fbe::Award
- Defined in:
- lib/fbe/award.rb
Overview
A generator of awards.
First, you should create a policy, using the same Lisp-ish syntax as we use in queries to a Factbase, for example:
require 'fbe/award'
a = Fbe::Award.new('(award (in loc "lines") (give (times loc 5) "for LoC"))')
Then, you can either get a bill from it:
b = a.bill(loc: 345)
puts b.points # how many points to reward, a number
puts b.greeting # how to explain the reward, a text
Or else, you can get a policy text:
p = a.policy
puts p.markdown # Markdown of the policy
- Author
-
Yegor Bugayenko (yegor256@gmail.com)
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Defined Under Namespace
Classes: BTerm, Bill, PTerm, Policy
Instance Method Summary collapse
- #bill(vars = {}) ⇒ Object
-
#initialize(query = J.pmp.hr.send($judge.gsub('-', '_'))) ⇒ Award
constructor
A new instance of Award.
- #policy ⇒ Object
Constructor Details
#initialize(query = J.pmp.hr.send($judge.gsub('-', '_'))) ⇒ Award
Returns a new instance of Award.
50 51 52 |
# File 'lib/fbe/award.rb', line 50 def initialize(query = J.pmp.hr.send($judge.gsub('-', '_'))) @query = query end |