Class: WWW::TvTropes
- Inherits:
-
Object
- Object
- WWW::TvTropes
- Defined in:
- lib/www-tvtropes.rb,
lib/www-tvtropes/version.rb
Overview
:nodoc:
Constant Summary collapse
- VERSION =
'0.0.2'
Instance Method Summary collapse
-
#characters_as_device ⇒ Object
Returns hash (name => url) of “Characters As Device” tropes from tvtropes.org/pmwiki/pmwiki.php/Main/CharactersAsDevice.
-
#initialize {|_self| ... } ⇒ TvTropes
constructor
A new instance of TvTropes.
Constructor Details
#initialize {|_self| ... } ⇒ TvTropes
Returns a new instance of TvTropes.
33 34 35 |
# File 'lib/www-tvtropes.rb', line 33 def initialize yield self if block_given? end |
Instance Method Details
#characters_as_device ⇒ Object
Returns hash (name => url) of “Characters As Device” tropes from tvtropes.org/pmwiki/pmwiki.php/Main/CharactersAsDevice.
38 39 40 41 42 43 44 45 46 |
# File 'lib/www-tvtropes.rb', line 38 def characters_as_device tropes = {} doc = Nokogiri::HTML( open( 'http://tvtropes.org/pmwiki/pmwiki.php/Main/CharactersAsDevice'), nil, 'UTF-8' ) # XXX doc = Nokogiri::HTML( open( './CharactersAsDevice'), nil, 'UTF-8' ) doc.css('h2 + ul > li > a').each do |link| tropes[ link.content ] = link['href'] end return tropes end |