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.
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
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
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
Generated with the Darkfish Rdoc Generator 2.