Skip to content

Instantly share code, notes, and snippets.

@abhay
Created Dec 12, 2008
Embed
What would you like to do?
class Foo < Array
attr_accessor :something
def initialize(something, *rest)
$stderr.puts 'in initializer'
@something = something
super(rest)
end
def []=(n,x)
$stderr.puts "in setter method"
super
end
end
if __FILE__ == $0
f = Foo.new :something, 1, 3, 2
puts f.inspect
puts f.something.inspect
exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment