Class: Fbe::Award::Policy
- Inherits:
-
Object
- Object
- Fbe::Award::Policy
- Defined in:
- lib/fbe/award.rb
Overview
A policy.
Instance Attribute Summary collapse
-
#vars ⇒ Object
readonly
Returns the value of attribute vars.
Instance Method Summary collapse
-
#initialize ⇒ Policy
constructor
A new instance of Policy.
- #intro(text) ⇒ Object
- #line(line) ⇒ Object
- #markdown ⇒ Object
Constructor Details
#initialize ⇒ Policy
Returns a new instance of Policy.
262 263 264 265 |
# File 'lib/fbe/award.rb', line 262 def initialize @lines = [] @intro = '' end |
Instance Attribute Details
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
260 261 262 |
# File 'lib/fbe/award.rb', line 260 def vars @vars end |
Instance Method Details
#intro(text) ⇒ Object
267 268 269 |
# File 'lib/fbe/award.rb', line 267 def intro(text) @intro = text end |
#line(line) ⇒ Object
271 272 273 |
# File 'lib/fbe/award.rb', line 271 def line(line) @lines << line end |
#markdown ⇒ Object
275 276 277 278 279 280 281 |
# File 'lib/fbe/award.rb', line 275 def markdown pars = [] pars << "#{@intro}." unless @intro.empty? pars << 'Here is how it\'s calculated:' pars += @lines.each_with_index.map { |t, i| "#{i.zero? ? 'First' : 'Then'}, #{t}." } pars.join(' ').gsub('. Then, award ', ', and award ') end |