Class: Wikipedia::Url
- Inherits:
-
Object
- Object
- Wikipedia::Url
- Defined in:
- lib/wikipedia/url.rb
Instance Method Summary collapse
-
#initialize(wiki_url) ⇒ Url
constructor
A new instance of Url.
- #title ⇒ Object
Constructor Details
#initialize(wiki_url) ⇒ Url
Returns a new instance of Url.
6 7 8 |
# File 'lib/wikipedia/url.rb', line 6 def initialize(wiki_url) @wiki_url = wiki_url end |
Instance Method Details
#title ⇒ Object
10 11 12 13 14 15 |
# File 'lib/wikipedia/url.rb', line 10 def title return @title if @title uri = URI.parse( @wiki_url ) @title = Addressable::URI.unencode( uri.path.sub(/\/wiki\//, '') ) end |