Class: Rbs::Src::LockfileLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/src/lockfile_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lockfile:, repository_prefix:, rbs_prefix:) ⇒ LockfileLoader

Returns a new instance of LockfileLoader.



6
7
8
9
10
# File 'lib/rbs/src/lockfile_loader.rb', line 6

def initialize(lockfile:, repository_prefix:, rbs_prefix:)
  @lockfile = lockfile
  @repository_prefix = repository_prefix
  @rbs_prefix = rbs_prefix
end

Instance Attribute Details

#lockfile ⇒ Object (readonly)

Returns the value of attribute lockfile.



4
5
6
# File 'lib/rbs/src/lockfile_loader.rb', line 4

def lockfile
  @lockfile
end

#rbs_prefix ⇒ Object (readonly)

Returns the value of attribute rbs_prefix.



4
5
6
# File 'lib/rbs/src/lockfile_loader.rb', line 4

def rbs_prefix
  @rbs_prefix
end

#repository_prefix ⇒ Object (readonly)

Returns the value of attribute repository_prefix.



4
5
6
# File 'lib/rbs/src/lockfile_loader.rb', line 4

def repository_prefix
  @repository_prefix
end

Instance Method Details

#each_gem ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rbs/src/lockfile_loader.rb', line 12

def each_gem()
  lockfile.gems.each_value do |library|
    case source = library[:source]
    when RBS::Collection::Sources::Git
      gem = Gem.new(
        name: library[:name],
        version: library[:version],
        repository_prefix: repository_prefix,
        repository_dir: Pathname(source.repo_dir),
        rbs_prefix: rbs_prefix
      )

      yield gem, source.remote, source.revision
    end
  end
end