Skip to content

Instantly share code, notes, and snippets.

@ss2k

ss2k/test.rb Secret

Created April 26, 2014 02:16
Show Gist options
  • Save ss2k/8eec94d19ce57f0b9404 to your computer and use it in GitHub Desktop.
Save ss2k/8eec94d19ce57f0b9404 to your computer and use it in GitHub Desktop.
class Test
def add
end
end
test = Test.new
test.add(50)
p test.scores # [50]
test.add(60)
p test.scores # [50,60]
@awstahl
Copy link

awstahl commented Apr 26, 2014

def initialize
@scores = [ ]
end

def add(val)
@scores << val
end

attr_reader :scores

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment