Class: Pokeberu::Converter
- Inherits:
-
Object
- Object
- Pokeberu::Converter
- Defined in:
- lib/pokeberu/converter.rb
Constant Summary collapse
- TABLE =
[ %w(あ い う え お A B C D E), %w(か き く け こ F G H I J), %w(さ し す せ そ K L M N O), %w(た ち つ て と P Q R S T), %w(な に ぬ ね の U V W X Y), %w(は ひ ふ へ ほ Z ? ! - /), %w(ま み む め も ¥ & 🕒 ☎️ ☕️), %w(や ( ゆ ) よ * # \ ? ?), %w(ら り る れ ろ 1 2 3 4 5), %w(わ を ん ゛ ゜ 6 7 8 9 0),
- HELP_COL_WIDTH =
4
- H_BORDER =
'-'
- V_BORDER =
'|'
Instance Method Summary collapse
Instance Method Details
#help ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pokeberu/converter.rb', line 33 def help tr = [] TABLE.each.with_index(1) do |row, i| tr << draw_full_border tr << draw_char_cols(row) tr << draw_num_cols(i) end tr << draw_full_border tr.map(&method(:format_row)).join("\n") end |
#to_chars(input) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pokeberu/converter.rb', line 19 def to_chars(input) to_c = -> ((row, col)) { TABLE[row][col] } input .each_char .map(&:to_i) .map(&:pred) .each_slice(2) .map(&to_c) .join .katakana .zen_to_han end |