Skip to content

Instantly share code, notes, and snippets.

@jcsalterego
Created August 15, 2013 22:45
Show Gist options
  • Select an option

  • Save jcsalterego/6245651 to your computer and use it in GitHub Desktop.

Select an option

Save jcsalterego/6245651 to your computer and use it in GitHub Desktop.
class Employee < Person
include SalaryUtils
attr_accessor :annual_salary
def weekly_salary
hourly_rate(annual_salary) * 40
end
end
class Person
attr_accessor :name
end
module SalaryUtils
HOURS_PER_YEAR = 52*40
def hourly_rate(salary)
salary.to_f / HOURS_PER_YEAR
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment