Class: WKCheck::CriticalItems
- Inherits:
-
Object
- Object
- WKCheck::CriticalItems
- Defined in:
- lib/wkcheck/critical_items.rb
Instance Method Summary collapse
- #critical_items ⇒ Object
-
#initialize(percentage) ⇒ CriticalItems
constructor
A new instance of CriticalItems.
Constructor Details
#initialize(percentage) ⇒ CriticalItems
Returns a new instance of CriticalItems.
3 4 5 |
# File 'lib/wkcheck/critical_items.rb', line 3 def initialize(percentage) @percentage = percentage end |
Instance Method Details
#critical_items ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wkcheck/critical_items.rb', line 7 def critical_items critical = Wanikani::CriticalItems.critical(@percentage).sort_by { |item| item["type"] } if critical.empty? Rainbow("Awesome, you have no items under #{@percentage} percent correct! Keep on rockin'!").bright.green else summary = Rainbow("Your Critical Items - Max percentage: #{@percentage} ").bright.white summary += "(#{Rainbow('Kanji').red}, #{Rainbow('Radicals').cyan}, #{Rainbow('Vocabulary').magenta}):\n" summary += critical.map { |item| send("#{item["type"]}_info", item) }.compact.join("\n") end end |