Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Brahyt
Created April 3, 2012 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Brahyt/2295523 to your computer and use it in GitHub Desktop.
Save Brahyt/2295523 to your computer and use it in GitHub Desktop.
class NewCard
def initialize(name, life, damage)
@cardname = name
@life = life
@damage = damage
end
def card
cardname = @cardname #<= This value
life = @life
damage = @damage
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