attachment_magick 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attachment_magick (0.1.0)
4
+ attachment_magick (0.2.0)
5
5
  dragonfly (>= 0.8.1)
6
6
  jquery-rails (>= 0.2.7)
7
7
  marcosinger-auto_html (>= 1.3.4)
@@ -67,8 +67,11 @@ module AttachmentMagick
67
67
  def grid_methods
68
68
  self.attachment_magick_default_options[:styles].each do |key, value|
69
69
  self.send :define_singleton_method, "style_#{key.to_s}" do
70
+ value[:width] = value[:width] == 0 ? nil : value[:width]
71
+ value[:height] = value[:height] == 0 ? nil : value[:height]
72
+
70
73
  metric = "#{value[:width]}x#{value[:height]}"
71
- metric = "#{metric}#" if value[:height] && value[:crop] == true
74
+ metric = "#{metric}#{value[:ajust]}" if value[:ajust]
72
75
 
73
76
  return metric
74
77
  end
@@ -7,7 +7,6 @@ module AttachmentMagick
7
7
  @set = set
8
8
  @styles = {}
9
9
  @default_grids = default_grids
10
- @default_options = {:crop => true}
11
10
  end
12
11
 
13
12
  def method_missing(name, *params, &blk)
@@ -21,13 +20,14 @@ module AttachmentMagick
21
20
  options = {}
22
21
  options.merge!(:width => values.first.to_i) if values.first
23
22
  options.merge!(:height => values.last.to_i) if values.second
23
+ options.merge!(:ajust => values.second.match(/\W/).to_s) unless values.second.match(/\W/).to_s.blank? if values.second
24
24
 
25
25
  options = @default_grids[name.to_sym].merge(options)
26
26
  elsif options.is_a?(Hash)
27
27
  options = @default_grids[name.to_sym].merge(options)
28
28
  end
29
29
 
30
- @styles.merge!(name.to_sym => @default_options.merge(options))
30
+ @styles.merge!(name.to_sym => options)
31
31
  end
32
32
 
33
33
  def styles
@@ -1,3 +1,3 @@
1
1
  module AttachmentMagick
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -5,7 +5,7 @@ class ArtistTest < ActiveSupport::TestCase
5
5
  assert_equal "36x36", Artist.style_thumb
6
6
  assert_equal "54x", Artist.style_grid_1
7
7
  assert_equal "150x", Artist.style_grid_10
8
- assert_equal "200x300#", Artist.style_grid_15
8
+ assert_equal "200x300", Artist.style_grid_15
9
9
  assert_equal "909x230#", Artist.style_grid_16
10
10
  end
11
11
  end
@@ -22,12 +22,14 @@ class AttachmentMagickTest < ActiveSupport::TestCase
22
22
 
23
23
  attachment_magick do
24
24
  grid_1 "300x150"
25
+ grid_7 "x560>"
25
26
  end
26
27
  end
27
28
 
28
29
  test "deveria manter o valor do grid original" do
29
- assert_equal "300x150#", Cat.style_grid_1
30
- assert_equal "54x", Dog.style_grid_1
30
+ assert_equal "300x150", Cat.style_grid_1
31
+ assert_equal "x560>", Cat.style_grid_7
32
+ assert_equal "54x", Dog.style_grid_1
31
33
  end
32
34
 
33
35
  def test_has_attachment_magick
@@ -12,8 +12,8 @@ class Artist
12
12
  grid_1
13
13
  grid_10 :width => 150
14
14
  grid_15 "200x300"
15
- grid_16 :height => 230
16
- thumb :crop => false
15
+ grid_16 :height => 230, :ajust => "#"
16
+ thumb
17
17
  fullscreen
18
18
  publisher
19
19
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: attachment_magick
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Marco Ant\xC3\xB4nio Singer"
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-04-08 00:00:00 -03:00
14
+ date: 2011-04-09 00:00:00 -03:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency