Module: ForgivingURI::IDNA
- Defined in:
- lib/rfeedparser/forgiving_uri.rb
Overview
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.
Class Method Summary collapse
-
.to_ascii(label) ⇒ Object
Returns the ascii representation of the label.
-
.to_unicode(label) ⇒ Object
Returns the unicode representation of the label.
Class Method Details
.to_ascii(label) ⇒ Object
Returns the ascii representation of the label.
778 779 780 781 782 783 784 785 786 787 |
# File 'lib/rfeedparser/forgiving_uri.rb', line 778 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) ⇒ Object
Returns the unicode representation of the label.
790 791 792 793 794 795 796 797 798 799 |
# File 'lib/rfeedparser/forgiving_uri.rb', line 790 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 |