Created
April 15, 2009 14:06
-
-
Save shelling/95787 to your computer and use it in GitHub Desktop.
an example shows how to initialize more instance variable of Array object
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
#!/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