summaryrefslogtreecommitdiff
path: root/lib/bundler/stub_specification.rb
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-05-30 17:34:30 -0700
committerAndre Arko <andre@arko.net>2015-05-30 17:34:32 -0700
commit6817f3ad86bceb5f56108a67d3a1f7b11d78dc69 (patch)
tree113b7db14f124f1187935d2ed715779fc5e3f183 /lib/bundler/stub_specification.rb
parentd93b37e49266fd7adfd550f12295ac2593605085 (diff)
downloadbundler-6817f3ad86bceb5f56108a67d3a1f7b11d78dc69.tar.gz
Hoist StubSpecification up into a file
Diffstat (limited to 'lib/bundler/stub_specification.rb')
-rw-r--r--lib/bundler/stub_specification.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb
new file mode 100644
index 0000000000..53db25c7ed
--- /dev/null
+++ b/lib/bundler/stub_specification.rb
@@ -0,0 +1,21 @@
+require 'bundler/remote_specification'
+
+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