Class: Torba::RemoteSources::Npm
- Defined in:
- lib/torba/remote_sources/npm.rb
Overview
Represents npm package.
Instance Attribute Summary collapse
-
#package ⇒ String
readonly
Package name.
-
#version ⇒ String
readonly
Package version.
Attributes inherited from Targz
Instance Method Summary collapse
-
#initialize(package, version) ⇒ Npm
constructor
A new instance of Npm.
Methods included from Common
Constructor Details
#initialize(package, version) ⇒ Npm
Returns a new instance of Npm.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/torba/remote_sources/npm.rb', line 21 def initialize(package, version) @package = package @version = version # https://docs.npmjs.com/about-scopes # "@lottiefiles/lottie-player" => "lottie-player" unscoped_package = package.sub(%r{@[^/]+/}, "") super("https://registry.npmjs.org/#{package}/-/#{unscoped_package}-#{version}.tgz") @digest = "#{package}-#{Torba.digest(url)}" end |
Instance Attribute Details
#package ⇒ String (readonly)
Returns package name.
12 13 14 |
# File 'lib/torba/remote_sources/npm.rb', line 12 def package @package end |
#version ⇒ String (readonly)
Returns package version.
17 18 19 |
# File 'lib/torba/remote_sources/npm.rb', line 17 def version @version end |