Created
May 4, 2013 07:17
-
-
Save BrayanZ/5516605 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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