Class: I18n::Coverage::Printers::BasicPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n/coverage/printers/basic_printer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ BasicPrinter

Returns a new instance of BasicPrinter.



9
10
11
# File 'lib/i18n/coverage/printers/basic_printer.rb', line 9

def initialize(report)
  @report = report
end

Class Method Details



5
6
7
# File 'lib/i18n/coverage/printers/basic_printer.rb', line 5

def self.print(report)
  new(report).print
end

Instance Method Details



13
14
15
16
17
18
19
20
21
22
# File 'lib/i18n/coverage/printers/basic_printer.rb', line 13

def print
  puts ''
  puts "I18n Coverage: #{@report[:percentage_used].round(2)}% of the keys used"
  puts "#{@report[:key_count]} keys found in yml files, #{@report[:used_key_count]} keys used during the tests"

  return unless @report[:unused_keys]

  puts 'Unused keys:'
  @report[:unused_keys].map { |k| puts "  #{k}" }
end