class Pagibig
Constants
- MAX_ALLOWABLE_COMPENSATION
Public Instance Methods
call()
click to toggle source
# File lib/pagibig_calculator.rb, line 9 def call load_csv reset_compensation if more_than_allowed_compensation? set_bracket set_employer_share set_employee_share return_contributions end
Private Instance Methods
load_csv()
click to toggle source
# File lib/pagibig_calculator.rb, line 20 def load_csv @csv = get_rows_from_csv("pagibig_table.csv") end
more_than_allowed_compensation?()
click to toggle source
# File lib/pagibig_calculator.rb, line 28 def more_than_allowed_compensation? @compensation >= MAX_ALLOWABLE_COMPENSATION end
reset_compensation()
click to toggle source
# File lib/pagibig_calculator.rb, line 32 def reset_compensation @compensation = MAX_ALLOWABLE_COMPENSATION end
return_contributions()
click to toggle source
# File lib/pagibig_calculator.rb, line 44 def return_contributions { employee_share: @employee_share, employer_share: @employer_share } end
set_bracket()
click to toggle source
# File lib/pagibig_calculator.rb, line 24 def set_bracket @bracket = @csv.select { |row| row["min"] <= @compensation && row["max"] >= @compensation }.first end