module KanaRow
Constants
- KANAS_MAP
- MARKED_KANA_ROWS
- SPECIAL_KANAS_MAP
- VERSION
Public Instance Methods
kana_row(marked_to_plain: true, include_special: true)
click to toggle source
# File lib/kana_row.rb, line 36 def kana_row(marked_to_plain: true, include_special: true) kana = self.chr.han_to_zen return unless kana.kana? if is_hiragana = kana.hiragana? kana = kana.katakana end row = kanas_map(include_special: include_special).find{|_, v| v.include?(kana) }&.first row = MARKED_KANA_ROWS.fetch(row, row) if marked_to_plain row = row&.hiragana if is_hiragana row end
Private Instance Methods
kanas_map(include_special: true)
click to toggle source
# File lib/kana_row.rb, line 53 def kanas_map(include_special: true) special = include_special || {} special = SPECIAL_KANAS_MAP unless special.is_a? Hash KANAS_MAP.merge(special) do |key, this_val, other_val| other_val = case other_val when String then other_val.split('') when Array then other_val else [] end this_val + other_val end end