Sha256: 1152a03d56d5ff346bb2af4a6427466cfa3a3236316b7bf04ed664dcb68169bc

Contents?: true

Size: 443 Bytes

Versions: 8

Compression:

Stored size: 443 Bytes

Contents

require 'unf/version'

module UNF
  autoload :Normalizer, 'unf/normalizer'
end

class String
  ascii_only =
    if method_defined?(:ascii_only?)
      'ascii_only?'
    else
      '/[^\x00-\x7f]/ !~ self'
    end

  [:nfc, :nfd, :nfkc, :nfkd].each { |form|
    eval %{
      def to_#{form.to_s}
        if #{ascii_only}
          self
        else
          UNF::Normalizer.normalize(self, #{form.inspect})
        end
      end
    }
  }
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
unf-0.1.0 lib/unf.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/unf-0.0.5/lib/unf.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/unf-0.0.5/lib/unf.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/unf-0.0.5/lib/unf.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/unf-0.0.5/lib/unf.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/unf-0.0.5/lib/unf.rb
unf-0.0.5-jruby lib/unf.rb
unf-0.0.5 lib/unf.rb