Sha256: c1f88f639ccc79eff586c5157e0287d78578c6f5ae6e9ac3e5b4e383f95d11b9

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Miyabi
  module CheckString
    def hiragana?
      return true if self =~ /\p{hiragana}/
      false
    end

    alias is_hira? hiragana?
    alias hira? hiragana?

    def japanese?
      return true if self =~ /\A(?:\p{Hiragana}|\p{Katakana}|[ー-]|[一-龠々])+\z/
      false
    end

    alias is_japanese? japanese?

    def katakana?
      return true if self =~ /\p{katakana}/
      false
    end

    alias is_kana? katakana?

    def kanji?
      return true if self =~ /^[一-龥]+$/
      false
    end

    alias is_kanji? kanji?

    def roman?
      return true if self =~ /^[a-zA-Z]+$/
      false
    end

    alias is_roman? roman?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
miyabi-0.3.1 lib/miyabi/check_string.rb