Class: FindT::Printer
- Inherits:
-
Object
- Object
- FindT::Printer
- Defined in:
- lib/find_t/printer.rb
Instance Method Summary collapse
-
#initialize(root_path) ⇒ Printer
constructor
A new instance of Printer.
- #print(name, founds) ⇒ Object
Constructor Details
#initialize(root_path) ⇒ Printer
Returns a new instance of Printer.
7 8 9 |
# File 'lib/find_t/printer.rb', line 7 def initialize(root_path) @root_path = Pathname.new root_path end |
Instance Method Details
#print(name, founds) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/find_t/printer.rb', line 11 def print(name, founds) unless founds.any? print_empty name return end founds .reverse .group_by { |f| f[:locale] } .sort_by { |f| f[0] } .each do |(locale, locale_founds)| print_title locale locale_founds.each.with_index do |found, i| print_translation found, i.zero? end end end |