refactor card.rb