Skip to content

Instantly share code, notes, and snippets.

@rosiehoyem
Last active December 25, 2015 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosiehoyem/7023062 to your computer and use it in GitHub Desktop.
Save rosiehoyem/7023062 to your computer and use it in GitHub Desktop.
class Plastic
def initialize
@plastic_bin = []
@plastic_types = ["num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7"]
end
def recycle_plastic(trash)
self.plastic_bin << trash if plastic_types.include?(trash)
end
end
class Glass
def initialize
@glass_bin = []
@glass_types = ["clear", "color"]
def recycle_glass(trash)
self.glass_bin << trash if glass_types.include?(trash)
end
end
class Paper
def initialize
@paper_bin = []
@paper_types = ["paper", "cardboard"]
end
def recycle_paper(trash)
self.paper_bin << trash if paper_types.include?(trash)
end
end
class Metal
def initialize
@metal_bin = []
@metal_types = ["aluminum", "tin", "copper"]
end
def recycle_metal(trash)
self.metal_bin << trash if metal_types.include?(trash)
end
end
class Landfill
def initialize
@landfill_bin = []
end
def landfill(trash)
Metal.metal_types.include?(trash)
Paper.paper_types.include?(trash)
Glass.glass_types.include?(trash)
Plastic.plastic_types.include?(trash)
self.landfill_bin << trash
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment