Sha256: ce93b92ee3eed57d8f2e7240291ad3bc036b956c41097bddb15cddd2f08daed8

Contents?: true

Size: 389 Bytes

Versions: 2

Compression:

Stored size: 389 Bytes

Contents

require 'uri'
require 'addressable'

module Wikipedia
  class Url
    def initialize(wiki_url)
      @wiki_url = wiki_url
    end

    def title
      return @title if @title

      uri     = URI.parse( @wiki_url )
      @title  =
        if uri.path.empty?
          @wiki_url
        else
          Addressable::URI.unencode( uri.path.sub(/\/wiki\//, '') )
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wikipedia-client-1.17.0 lib/wikipedia/url.rb
wikipedia-client-1.16.0 lib/wikipedia/url.rb