Class: Est::Estimate

Inherits:
Object
  • Object
show all
Defined in:
lib/est/estimate.rb

Overview

Estimate.

Defined Under Namespace

Classes: Const

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Estimate

Ctor.

file

File with YAML estimate



38
39
40
41
# File 'lib/est/estimate.rb', line 38

def initialize(file)
  @yaml = YAML.load_file(file)
  fail "failed to read file #{file}" unless @yaml
end

Instance Method Details

#authorObject

Get author.



49
50
51
# File 'lib/est/estimate.rb', line 49

def author
  @yaml['author']
end

#dateObject

Get date.



44
45
46
# File 'lib/est/estimate.rb', line 44

def date
  Date.strptime(@yaml['date'], '%d-%m-%Y')
end

#totalObject

Get total estimate.



54
55
56
57
58
# File 'lib/est/estimate.rb', line 54

def total
  method = @yaml['method']
  fail "unsupported method #{method}" unless method == 'champions.pert'
  Champions.new(@yaml).total
end