Skip to content

Instantly share code, notes, and snippets.

@rudkovskyi

rudkovskyi/example.rb

Last active Nov 22, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.