Class: Torba::RemoteSources::Npm

Inherits:
Targz
  • Object
show all
Defined in:
lib/torba/remote_sources/npm.rb

Overview

Represents npm package.

Since:

  • 0.3.0

Instance Attribute Summary collapse

Attributes inherited from Targz

#digest, #url

Instance Method Summary collapse

Methods included from Common

#[], #digest

Constructor Details

#initialize(package, version) ⇒ Npm

Returns a new instance of Npm.

Parameters:

Since:

  • 0.3.0



20
21
22
23
24
25
# File 'lib/torba/remote_sources/npm.rb', line 20

def initialize(package, version)
  @package = package
  @version = version
  super("https://registry.npmjs.org/#{package}/-/#{package}-#{version}.tgz")
  @digest = "#{package}-#{Torba.digest(url)}"
end

Instance Attribute Details

#packageString (readonly)

Returns package name.

Examples:

"coffee-script"

Returns:

  • (String)

    package name.

Since:

  • 0.3.0



11
12
13
# File 'lib/torba/remote_sources/npm.rb', line 11

def package
  @package
end

#versionString (readonly)

Returns package version.

Examples:

"1.8.3"

Returns:

  • (String)

    package version.

Since:

  • 0.3.0



16
17
18
# File 'lib/torba/remote_sources/npm.rb', line 16

def version
  @version
end