Skip to content

Instantly share code, notes, and snippets.

@shelling
Created April 15, 2009 14:06
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 shelling/95787 to your computer and use it in GitHub Desktop.
Save shelling/95787 to your computer and use it in GitHub Desktop.
an example shows how to initialize more instance variable of Array object
#!/usr/bin/env ruby
# shelling
# This script show how to initialize more instance variables when creating an Array object
class Array
attr_reader :this
def initialize
super
@this = 0
end
end
a = Array.new
puts a.this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment