Skip to content

Instantly share code, notes, and snippets.

@BrayanZ
Created May 4, 2013 07:17
Show Gist options
  • Save BrayanZ/5516605 to your computer and use it in GitHub Desktop.
Save BrayanZ/5516605 to your computer and use it in GitHub Desktop.
class Company
def open_headquarter headquarter
@headquarters << headquarter
end
def close_headquarter(headquarter_name)
@headquarters.delete_if{ |headquater| headquarter.name == headquarter_name }
end
end
class Headquater
def initialize(name, positions=[])
@name = name
@positions = positions
end
def add_position position
@positions << position
end
end
class Position
def initialize(name, base_salary)
@name = name
@base_salary = base_salary
end
def change_base_salary new_salary
@base_salary = new_salary
end
def hire_employee employee
@employees << employee
end
end
class Employee
def initialize(name)
@name = name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment