class String
Constants
- HANZEN_RE
- HANZEN_TAB
Public Instance Methods
first()
click to toggle source
# File lib/migemo/core_ext/string.rb, line 7 def first /^(\\.|.)/ =~ self $1 end
last()
click to toggle source
# File lib/migemo/core_ext/string.rb, line 12 def last /(\\.|.)$/ =~ self $1 end
prefix_match(string)
click to toggle source
# File lib/migemo/core_ext/string.rb, line 56 def prefix_match (string) self[0, string.length] <=> string end
rest()
click to toggle source
# File lib/migemo/core_ext/string.rb, line 17 def rest /^(\\.|.)(.*)/ =~ self $2 end
to_fullwidth()
click to toggle source
# File lib/migemo/core_ext/string.rb, line 52 def to_fullwidth self.gsub(HANZEN_RE) {|s| HANZEN_TAB[s]} end
to_katakana()
click to toggle source
Hiragana to Katakana
# File lib/migemo/core_ext/string.rb, line 3 def to_katakana self.gsub(/う゛/, 'ヴ').tr('ぁ-ん', 'ァ-ン') end