And here we see the elusive Attr_accessor in it’s natural habitat, just above the initialize method.
attr_accessor :rank, :suit
def initialize(rank, suit)
@rank, @suit = rank, suit
Watch how gracefully it executes a reader and writer method in a single line, making the following code unnecessary:
def rank #reader method
def rank=rank #writer method
She truly is a beautiful beast.