Class: GemContribute::LockedGem

Inherits:
Data
  • Object
show all
Defined in:
lib/gem_contribute/locked_gem.rb

Overview

A single dependency parsed from Gemfile.lock.

The design doc calls this “a Gem”; the in-code name is LockedGem to avoid shadowing Ruby’s stdlib ::Gem inside the GemContribute namespace. See ADR-0009.

‘source_type` is one of:

:rubygems  — published to a RubyGems-compatible index
:git       — `gem 'foo', git: '…'`
:path      — `gem 'foo', path: '…'`
:bundler   — Bundler itself (only present in lockfiles via DEPENDENCIES)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



15
16
17
# File 'lib/gem_contribute/locked_gem.rb', line 15

def name
  @name
end

#source_typeObject (readonly)

Returns the value of attribute source_type

Returns:

  • (Object)

    the current value of source_type



15
16
17
# File 'lib/gem_contribute/locked_gem.rb', line 15

def source_type
  @source_type
end

#source_uriObject (readonly)

Returns the value of attribute source_uri

Returns:

  • (Object)

    the current value of source_uri



15
16
17
# File 'lib/gem_contribute/locked_gem.rb', line 15

def source_uri
  @source_uri
end

#versionObject (readonly)

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



15
16
17
# File 'lib/gem_contribute/locked_gem.rb', line 15

def version
  @version
end

Instance Method Details

#resolvable?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/gem_contribute/locked_gem.rb', line 20

def resolvable?
  # We can only ask the RubyGems API about things we got from RubyGems.
  # See ADR-0003 for what we do with the answer.
  rubygems?
end

#rubygems?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/gem_contribute/locked_gem.rb', line 16

def rubygems?
  source_type == :rubygems
end