Class: EarnedValueCalculator::Validator

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/earned_value_calculator/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_date, end_date, current_date, budget, rate, actual_cost) ⇒ Validator

Returns a new instance of Validator.

Parameters:

  • start_date (Date)

    The project start date.

  • end_date (Date)

    The project deadline.

  • current_date (Date)

    The current date.

  • budget (Integer)

    The Budget At Completion of the project.

  • rate (Integer)

    The actual rate of progression.

  • actual_cost (Integer)

    The actual full actual_cost of the project.

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
33
34
35
# File 'lib/earned_value_calculator/validator.rb', line 26

def initialize(start_date, end_date, current_date, budget, rate, actual_cost)
  self.start_date = start_date
  self.end_date = end_date
  self.current_date = current_date
  self.budget = budget
  self.rate = rate
  self.actual_cost = actual_cost

  raise ArgumentError, errors.messages unless valid?
end

Instance Attribute Details

#actual_costObject

Returns the value of attribute actual_cost.



10
11
12
# File 'lib/earned_value_calculator/validator.rb', line 10

def actual_cost
  @actual_cost
end

#budgetObject

Returns the value of attribute budget.



10
11
12
# File 'lib/earned_value_calculator/validator.rb', line 10

def budget
  @budget
end

#current_dateObject

Returns the value of attribute current_date.



10
11
12
# File 'lib/earned_value_calculator/validator.rb', line 10

def current_date
  @current_date
end

#end_dateObject

Returns the value of attribute end_date.



10
11
12
# File 'lib/earned_value_calculator/validator.rb', line 10

def end_date
  @end_date
end

#rateObject

Returns the value of attribute rate.



10
11
12
# File 'lib/earned_value_calculator/validator.rb', line 10

def rate
  @rate
end

#start_dateObject

Returns the value of attribute start_date.



10
11
12
# File 'lib/earned_value_calculator/validator.rb', line 10

def start_date
  @start_date
end