Module: FeedTools::URI::IDNA

Defined in:
lib/feed_tools/vendor/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

Class Method Details

.to_ascii(label) ⇒ Object

Returns the ascii representation of the label.



622
623
624
625
626
627
628
629
630
631
# 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) ⇒ Object

Returns the unicode representation of the label.



634
635
636
637
638
639
640
641
642
643
# 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