Skip to content

Instantly share code, notes, and snippets.

@hone
Forked from Brahyt/gist:2295523
Created April 3, 2012 21:47
Show Gist options
  • Save hone/2295728 to your computer and use it in GitHub Desktop.
Save hone/2295728 to your computer and use it in GitHub Desktop.
class NewCard
attr_reader :cardname
def initialize(name, life, damage)
@cardname = name
@life = life
@damage = damage
end
def card
cardname = @cardname #<= This value
life = @life
damage = @damage
self
end
end
attack_card_a = NewCard.new("attack card", 3, 2)
attack_card_b = NewCard.new("atack card of justice", 5, 1)
puts attack_card_a.card.cardname #Is it possible to call the varible cardname and puts it from here?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment