Last active
November 22, 2015 18:12
-
-
Save paractmol/d96e4d88726b2128bddf to your computer and use it in GitHub Desktop.
This file contains 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 Collection | |
class Instance | |
def initialize(id) | |
@id = id | |
end | |
def say | |
"I am #{@id}" | |
end | |
end | |
def initialize(ary) | |
@ary = ary | |
end | |
def inspect | |
@ary | |
end | |
def [] id | |
raise "Array does not contain #{id}" unless @ary.include?(id) | |
Instance.new id | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment