open-uri-s3 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eae0d4c08066f1be7dd933722005605ef95719c8
4
- data.tar.gz: ae125e095656d6d966bcbcabba34da7302d3dfc1
3
+ metadata.gz: 48b2c9662ebe7fdafe18502ad7cc1498d6b05419
4
+ data.tar.gz: dba690b426ef69c7659764c69f0926e7586c6eaa
5
5
  SHA512:
6
- metadata.gz: 44689a66321b6b5b09e2bc3e782c0a04115862bc1299732dd91bbd2e40e95a1a7acae216351001663abd1788d621da3e0f7aba3c8b6f2b07cae243da22f3e28f
7
- data.tar.gz: fe9a45ffc34f80734d388374d9c9bc8c5b6d75a99746d20620e46d15f3502e06d0d780c77ba3e144a8d416b6da621ba74ccb985e38e2a9f2f829a486c3e79fea
6
+ metadata.gz: f94cf95c711871a998385d07db10510e0e491dc1fcfbe1d5dd2b3e0e2cb6e29ad2a8938a2ee83572b2b81e1363e6eaab75dff8ed24a84fd2e2ab5db85a0742f3
7
+ data.tar.gz: ab196aada79e18483c80a78272317922c2cb166730e8ce95eaff645dce4444a7f552f73bb7031233ce46828c5c9a6cc7d2725997f8ded212f11154a9b55053bb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
data/lib/open-uri-s3.rb CHANGED
@@ -17,11 +17,11 @@ module URI
17
17
  path = self.path[1..-1]
18
18
  object = bucket.objects[path]
19
19
 
20
- if args[0] == 'w'
20
+ if block_given?
21
21
  yield object
22
+ else
23
+ object
22
24
  end
23
-
24
- object
25
25
  end
26
26
 
27
27
  def read
data/open-uri-s3.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "open-uri-s3"
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erik Terpstra"]
12
- s.date = "2015-03-06"
12
+ s.date = "2015-03-09"
13
13
  s.description = "AWS S3 protocol support for open-uri"
14
14
  s.email = "erterpstra@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -13,6 +13,22 @@ describe URI::S3 do
13
13
  allow(AWS::S3).to receive(:new).and_return(s3)
14
14
  end
15
15
 
16
+ describe "open" do
17
+ it "returns the S3 object" do
18
+ expect(open(uri)).to eq object
19
+ end
20
+
21
+ context "when a block is given" do
22
+ it "yields the object" do
23
+ expect { |b| open(uri, &b) }.to yield_with_args(object)
24
+ end
25
+
26
+ it "returns the result of the block" do
27
+ expect(open(uri) { 'result' }).to eq 'result'
28
+ end
29
+ end
30
+ end
31
+
16
32
  describe "#read" do
17
33
  it "reads the object" do
18
34
  expect(URI(uri).read).to eq 'contents'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open-uri-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-v1