| Module | FeedTools::URI::IDNA |
| In: |
lib/feed_tools/vendor/uri.rb
|
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
622: def self.to_ascii(label)
623: return nil if label.nil?
624: if self.use_libidn?
625: return IDN::Idna.toASCII(label)
626: else
627: raise NotImplementedError,
628: "There is no available pure-ruby implementation. " +
629: "Install libidn bindings."
630: end
631: end
Returns the unicode representation of the label.
# File lib/feed_tools/vendor/uri.rb, line 634
634: def self.to_unicode(label)
635: return nil if label.nil?
636: if self.use_libidn?
637: return IDN::Idna.toUnicode(label)
638: else
639: raise NotImplementedError,
640: "There is no available pure-ruby implementation. " +
641: "Install libidn bindings."
642: end
643: end