Class: Wikipedia::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/wikipedia/url.rb

Instance Method Summary collapse

Constructor Details

#initialize(wiki_url) ⇒ Url

Returns a new instance of Url.



3
4
5
# File 'lib/wikipedia/url.rb', line 3

def initialize(wiki_url)
  @wiki_url = wiki_url
end

Instance Method Details

#titleObject



7
8
9
10
11
12
# File 'lib/wikipedia/url.rb', line 7

def title
  return @title if @title

  uri     = URI.parse( @wiki_url )
  @title  = URI.decode( uri.path.sub(/\/wiki\//, '') )
end