retina_image_tag 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module RetinaImageTag
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -2,29 +2,23 @@ module RetinaImageTag
2
2
  module ViewHelpers
3
3
 
4
4
  def retina_image( pixel_ratio )
5
- @retina_image_path = image_path(@file_name+"@#{pixel_ratio}x"+@file_ext)
6
- image_tag(@retina_image_path, @options)
5
+ insert_on = -File.extname(@image).size-1
6
+ image_tag(@image.insert(insert_on, "@#{pixel_ratio}x"), @options)
7
7
  end
8
8
 
9
9
 
10
10
  def retina_image_tag(image, options = {})
11
11
  @devicePixelRatio = cookies[:devicePixelRatio]
12
12
  @options = options
13
- @image = image # foo.jpg
14
-
15
- @file_path = image_path(@image)
16
- @file_ext = File.extname(@file_path) # .jpg, .png
17
- @file_name = File.basename(@image, @file_ext) # pic1, foo
18
- @file_dirname = File.dirname(@file_path)
19
-
20
-
13
+ @image = image # foo.jpg, subdir/foo.png
14
+
21
15
  case @devicePixelRatio
22
16
  when '2'
23
- retina_image '2'
17
+ retina_image 2
24
18
  when '1.5'
25
- retina_image '2'
19
+ retina_image 2
26
20
  else
27
- image_tag(@file_path, @options)
21
+ image_tag(@image, @options)
28
22
  end
29
23
  end
30
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retina_image_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: