Class: InssCalculator::Legacy::SecondDiscountCalculator

Inherits:
DiscountCalculatorBase show all
Defined in:
lib/inss_calculator/legacy/second_discount_calculator.rb

Overview

SecondDiscountCalculator calculates between its range limit In case the salary is beyond this limit, it will use its quotation apply inside the range salary limit

Constant Summary collapse

QUOTATION =
0.09

Constants inherited from DiscountCalculatorBase

DiscountCalculatorBase::NO_CONTRIBUTION, DiscountCalculatorBase::SALARY_BASE

Instance Attribute Summary

Attributes inherited from DiscountCalculatorBase

#salary

Instance Method Summary collapse

Methods inherited from DiscountCalculatorBase

#initialize

Constructor Details

This class inherits a constructor from InssCalculator::DiscountCalculatorBase

Instance Method Details

#contributionObject



10
11
12
13
14
15
16
# File 'lib/inss_calculator/legacy/second_discount_calculator.rb', line 10

def contribution
  return NO_CONTRIBUTION if salary <= salary_base

  return full_contribution if salary > salary_limit

  calculate_contribution
end