on_the_fly 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/on_the_fly.rb +9 -4
  2. metadata +3 -3
data/lib/on_the_fly.rb CHANGED
@@ -11,14 +11,12 @@ Paperclip::Attachment.class_eval do
11
11
  def respond_to?(method,*args, &block)
12
12
  if method.to_s.match(/^s_[0-9]+_[0-9]+/) || method.to_s.match(/^s_[0-9]+_[a-z]+/) || method.to_s.match(/^s[0-9]+/) ||
13
13
  method.to_s.match(/^cls_[0-9]+_[0-9]+/) || method.to_s.match(/^cls_[0-9]+_[a-z]+/) || method.to_s.match(/^cls[0-9]+/)
14
- puts("IN METHOD TO S MATCH+++---:Method: #{method}")
15
14
  return true
16
15
  end
17
16
  super
18
17
  end
19
18
 
20
19
  def method_missing(symbol , *args, &block )
21
- #puts("IN METHOD MISSING+++---:symbol: #{symbol}")
22
20
  @asset_id = 0
23
21
  args.each do |val|
24
22
  @asset_id = val
@@ -65,7 +63,6 @@ Paperclip::Attachment.class_eval do
65
63
  prefix = "S_" + height.to_s + "_" + height.to_s + "_"
66
64
  end
67
65
 
68
- puts("!!!!!!!!SELF++: #{self}")
69
66
  path = self.path
70
67
  url = self.url
71
68
 
@@ -89,7 +86,8 @@ Paperclip::Attachment.class_eval do
89
86
  thumbfile = orig_arry.join("\\") + "\\thumb\\" + file_name if windows?
90
87
 
91
88
 
92
- return new_path if File.exist?(newfilename)
89
+ return new_path if File.exist?(newfilename)
90
+ return path if already_converted?
93
91
 
94
92
  if !File.exist?(original)
95
93
  if Paperclip.options[:whiny]
@@ -180,6 +178,13 @@ Paperclip::Attachment.class_eval do
180
178
  def windows?
181
179
  !(RUBY_PLATFORM =~ /win32|mswin|mingw/).nil?
182
180
  end
181
+
182
+ def already_converted?
183
+ if self.to_s.match(/^s_[0-9]+_[0-9]+/) || self.to_s.match(/^s_[0-9]+_[a-z]+/) || self.to_s.match(/^s[0-9]+/) ||
184
+ self.to_s.match(/^cls_[0-9]+_[0-9]+/) || self.to_s.match(/^cls_[0-9]+_[a-z]+/) || self.to_s.match(/^cls[0-9]+/)
185
+ return true
186
+ end
187
+ end
183
188
 
184
189
  end
185
190
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_the_fly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2011-08-10 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: paperclip
17
- requirement: &22064496 !ruby/object:Gem::Requirement
17
+ requirement: &22512576 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *22064496
25
+ version_requirements: *22512576
26
26
  description: ! "A Paperclip mix-in to allow auto-generation of resized images. Modded
27
27
  to delete images\n\tand rename the thumb works on only the ES3 AMS system right
28
28
  now."