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 +4 -4
- data/lib/nozzle/adapter/base.rb +7 -0
- data/lib/nozzle/version.rb +1 -1
- data/test/nozzle_adapter_base_test.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 744ba2831b2ea579906c1deeacb3a341414931e9
|
4
|
+
data.tar.gz: 334b10228722d116892a6de9996d4a17ff4808b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96390aff90f4a1a378c9d868e8bd3f807ead09c2aa4c70e5ce25121a3d6c5c6780fbd7fd66d312d741a22379c3d1c0d035740f6d04fddb678bb36e4091064ab5
|
7
|
+
data.tar.gz: 19cc8d6177db465a3e091680fb8122bdafc5a534677201e24f8b54fda6c8ef52cf1dc1f21b0f587a5837ca55422b7b9c5240592ed01fa5e85a0cf9d08b5a9a72
|
data/lib/nozzle/adapter/base.rb
CHANGED
@@ -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:
|
data/lib/nozzle/version.rb
CHANGED
@@ -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.
|
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-
|
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:
|