sequel_paperclip 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -52,7 +52,7 @@ module Sequel
52
52
  end
53
53
 
54
54
  def self.extname(attachment, model, style)
55
- File.extname(filename(attachment, model, style))
55
+ model.send("#{attachment.name}_extname")
56
56
  end
57
57
 
58
58
  def self.rails_root(attachment, model, style)
@@ -36,7 +36,7 @@ module Sequel
36
36
  filename = send("#{name}_filename")
37
37
  filename ? File.basename(filename) : nil
38
38
  end
39
-
39
+
40
40
  define_method("#{name}_basename=") do |basename|
41
41
  if basename
42
42
  old_filename = send("#{name}_filename")
@@ -46,6 +46,21 @@ module Sequel
46
46
  send("#{name}_filename=", nil)
47
47
  end
48
48
  end
49
+
50
+ define_method("#{name}_extname") do
51
+ filename = send("#{name}_filename")
52
+ filename ? File.extname(filename) : nil
53
+ end
54
+
55
+ define_method("#{name}_extname=") do |extname|
56
+ if extname
57
+ old_filename = send("#{name}_filename")
58
+ basename = old_filename ? File.basename(old_filename) : ""
59
+ send("#{name}_filename=", basename+extname)
60
+ else
61
+ send("#{name}_filename=", nil)
62
+ end
63
+ end
49
64
  end
50
65
 
51
66
  define_method("#{name}=") do |value|
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sequel_paperclip}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Corin Langosch"]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Corin Langosch