Class: Bundler::InstallDashDocs::DashInstallUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/install_dash_docs/dash_install_url.rb

Overview

A dash-specific URL for installing the given gem’s documentation at specified version

documentation kapeli.com/dash_install

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_name, version) ⇒ DashInstallUrl

Returns a new instance of DashInstallUrl.

Parameters:

  • gem_name (String)

    the name of the gem

  • version (String)

    the specific version of the gem



15
16
17
18
# File 'lib/bundler/install_dash_docs/dash_install_url.rb', line 15

def initialize(gem_name, version)
  @gem_name = gem_name
  @version = version
end

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



10
11
12
# File 'lib/bundler/install_dash_docs/dash_install_url.rb', line 10

def gem_name
  @gem_name
end

#versionObject (readonly)

Returns the value of attribute version.



10
11
12
# File 'lib/bundler/install_dash_docs/dash_install_url.rb', line 10

def version
  @version
end

Instance Method Details

#to_strString

Returns properly encoded URL to tell Dash.app to install this gem’s documentation.

Returns:

  • (String)

    properly encoded URL to tell Dash.app to install this gem’s documentation



22
23
24
25
26
27
# File 'lib/bundler/install_dash_docs/dash_install_url.rb', line 22

def to_str
  enc_name = Addressable::URI.encode_component(@gem_name, Addressable::URI::CharacterClasses::UNRESERVED)
  enc_version = Addressable::URI.encode_component(@version, Addressable::URI::CharacterClasses::UNRESERVED)

  "dash-install://repo_name=Ruby%20Docsets&entry_name=#{enc_name}&version=#{enc_version}"
end