summaryrefslogtreecommitdiff
path: root/lib/bundler/stub_specification.rb
blob: f4ee7d064413665fe2539b881cf90fb0398d87bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
require "bundler/remote_specification"

module Bundler
  class StubSpecification < RemoteSpecification
    def self.from_stub(stub)
      spec = new(stub.name, stub.version, stub.platform, nil)
      spec.stub = stub
      spec
    end

    attr_accessor :stub

    def to_yaml
      _remote_specification.to_yaml
    end

  private

    def _remote_specification
      stub.to_spec
    end
  end
end