Class/Module Index [+]

Quicksearch

FeedTools::URI::IDNA

This module handles internationalized domain names. When Ruby has an implementation of nameprep, stringprep, punycode, etc, this module should contain an actual implementation of IDNA instead of returning nil if libidn can't be used.

Public Class Methods

to_ascii(label) click to toggle source

Returns the ascii representation of the label.

# File lib/feed_tools/vendor/uri.rb, line 622
def self.to_ascii(label)
  return nil if label.nil?
  if self.use_libidn?
    return IDN::Idna.toASCII(label)
  else
    raise NotImplementedError,
      "There is no available pure-ruby implementation.  " +
      "Install libidn bindings."
  end
end
to_unicode(label) click to toggle source

Returns the unicode representation of the label.

# File lib/feed_tools/vendor/uri.rb, line 634
def self.to_unicode(label)
  return nil if label.nil?
  if self.use_libidn?
    return IDN::Idna.toUnicode(label)
  else
    raise NotImplementedError,
      "There is no available pure-ruby implementation.  " +
      "Install libidn bindings."
  end
end

Private Class Methods

use_libidn?() click to toggle source

Determines if the libidn bindings are available and able to be used.

# File lib/feed_tools/vendor/uri.rb, line 647
def self.use_libidn?
  if !defined?(@use_libidn) || @use_libidn.nil?
    begin
      require 'rubygems'
    rescue LoadError
    end
    begin
      require 'idn'
    rescue LoadError
    end
    @use_libidn = !!(defined?(IDN::Idna))
  end
  return @use_libidn
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.