Module FeedTools::URI::IDNA
In: lib/feed_tools/vendor/uri.rb
ActiveRecord::Base DatabaseFeedCache StandardError FeedAccessError FeedItem Feed URI Cloud Link Author Image Enclosure TextInput Category lib/feed_tools/feed_item.rb lib/feed_tools/feed.rb lib/feed_tools.rb lib/feed_tools/vendor/uri.rb lib/feed_tools/database_feed_cache.rb lib/feed_tools/feed_structures.rb FeedToolsHelper FeedItemHelper HtmlHelper DebugHelper FeedHelper XmlHelper UriHelper RetrievalHelper GenericHelper FEED_TOOLS_VERSION FeedTools dot/m_79_0.png

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.

Methods

Public Class methods

Returns the ascii representation of the label.

[Source]

     # 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.

[Source]

     # 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

Private Class methods

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

[Source]

     # File lib/feed_tools/vendor/uri.rb, line 647
647:       def self.use_libidn?
648:         if !defined?(@use_libidn) || @use_libidn.nil?
649:           begin
650:             require 'rubygems'
651:           rescue LoadError
652:           end
653:           begin
654:             require 'idn'
655:           rescue LoadError
656:           end
657:           @use_libidn = !!(defined?(IDN::Idna))
658:         end
659:         return @use_libidn
660:       end

[Validate]