lib/language_cards/controllers/game.rb in language_cards-0.2.0 vs lib/language_cards/controllers/game.rb in language_cards-0.3.0
- old
+ new
@@ -24,21 +24,21 @@
last: ic.valid? ? ic.correct_msg : ic.incorrect_msg
}
end
def struct_data
- Struct.new(:collection, :mode) do
+ Struct.new(:card_set, :mode) do
def input
@input
end
def get_input
@input ||= CLI.ask("#{I18n.t('Game.TypeThis')}: #{display}")
end
def card
- @card ||= collection.sample
+ @card ||= card_set.sample.current
end
def display
"#{card}"
end
@@ -58,15 +58,15 @@
"#{I18n.t('Game.Correct')} #{input} = #{display}"
end
def incorrect_msg
output = "#{I18n.t('Game.Incorrect')} #{input} != #{display}"
- output << " #{I18n.t('Game.Its')} #{expected}" if mode == :translate
+ output << " #{I18n.t('Game.Its')} #{expected.join(', ')}" if mode == :translate
output
end
def valid?
- !!(expected == input)
+ card_set.match? input
end
end
end
end
end