asset 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/asset.gemspec +1 -1
- data/lib/assets/helpers.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6278ea671a78e4cf156bb1dad148e268d11dcb9
|
4
|
+
data.tar.gz: b445698bdb23def5a03fa76c2ac1fbff5a673f12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b02ccb480ae994e3570013dd78ed99f4347686bdd6dd919ad1f7f213a9368be23713680c9820cebf19501bb7fa144ba06b705a31eaadff90d7e86cc799727ed1
|
7
|
+
data.tar.gz: 0d2d320cad89f38253d244d7489be2acf39f1ab61878c3648d44809408f99bfc27ceb66d0067cab2ac6e5ad2fbfdc0ffd25f9a7c9469469919834fbcaaba4aa8
|
data/CHANGELOG.md
CHANGED
data/asset.gemspec
CHANGED
data/lib/assets/helpers.rb
CHANGED
@@ -22,10 +22,16 @@ module Asset
|
|
22
22
|
|
23
23
|
# Image tags
|
24
24
|
def image_tag(path)
|
25
|
-
|
25
|
+
%{<img src="#{image_url(path)}">}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Image URL
|
29
|
+
def image_url(path)
|
26
30
|
# Just slip through if the path starts with http(s) or //
|
27
|
-
src = path =~ /^(http[s]?)?:?\/\// ? path : %{/
|
28
|
-
|
31
|
+
src = path =~ /^(http[s]?)?:?\/\// ? path : %{/images/#{path}}
|
32
|
+
|
33
|
+
# Return the path with timestamp if possible
|
34
|
+
%{#{src}#{(b = (::Asset.images[path] rescue nil)) ? "?#{b}" : ''}}
|
29
35
|
end
|
30
36
|
|
31
37
|
private
|