Class: Fbe::Award::Policy

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

Overview

A policy.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePolicy

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

#varsObject (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

#markdownObject



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