nozzle 0.1.1 → 0.1.2

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: 574bb2f5aafe5e663ec50b3237cacef48010aeab
4
- data.tar.gz: 0b66db6e1d494592209504e2fdd92c94c07ffa83
3
+ metadata.gz: 744ba2831b2ea579906c1deeacb3a341414931e9
4
+ data.tar.gz: 334b10228722d116892a6de9996d4a17ff4808b1
5
5
  SHA512:
6
- metadata.gz: a8054882ea0598df4fefabf947fdb5d512ff6d9d135a76c1ecd734fb92f70440a0eb223ca719a11f182df019a43cfbd44615ee2e9cf085244a863a5bc15d0c97
7
- data.tar.gz: 7489babd43a467689511eea8d175dfab7107e44b0af0236e5d4efd0da480427b159992df58f732016b42726eb62474aa861963e62083ca2970d7021b6eb789ca
6
+ metadata.gz: 96390aff90f4a1a378c9d868e8bd3f807ead09c2aa4c70e5ce25121a3d6c5c6780fbd7fd66d312d741a22379c3d1c0d035740f6d04fddb678bb36e4091064ab5
7
+ data.tar.gz: 19cc8d6177db465a3e091680fb8122bdafc5a534677201e24f8b54fda6c8ef52cf1dc1f21b0f587a5837ca55422b7b9c5240592ed01fa5e85a0cf9d08b5a9a72
@@ -39,6 +39,13 @@ module Nozzle
39
39
  default_url
40
40
  end
41
41
 
42
+ # Gets url and adds a cache busting timestamp to it.
43
+ # instance.avatar.url? # => '/uploads/Model/avatar/image.jpg?1373369401'
44
+ def url?
45
+ result = url
46
+ result && "#{result}?#{File.mtime(path).to_i}"
47
+ end
48
+
42
49
  # Constructs a filesustem path which absolutely points to stored file.
43
50
  # instance.avatar.path # => 'public/uploads/Model/avatar/image.jpg'
44
51
  # How it's constructed:
@@ -1,3 +1,3 @@
1
1
  module Nozzle
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -50,6 +50,8 @@ describe Nozzle::Adapter::Base do
50
50
 
51
51
  inst.save
52
52
  inst.avatar.path.must_equal public_path
53
+ inst.avatar.url.must_equal "/uploads/Klass1/avatar/test-697x960.jpg"
54
+ inst.avatar.url?.must_equal "/uploads/Klass1/avatar/test-697x960.jpg?#{File.mtime(public_path).to_i}"
53
55
  File.exists?(public_path).must_equal true
54
56
 
55
57
  inst.destroy
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nozzle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Bochkariov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-24 00:00:00.000000000 Z
11
+ date: 2013-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,3 +112,4 @@ test_files:
112
112
  - test/nozzle_adapter_outlet_test.rb
113
113
  - test/nozzle_adapter_test.rb
114
114
  - test/nozzle_test.rb
115
+ has_rdoc: