joint 0.6.1 → 0.6.2

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,52 +1,50 @@
1
1
  module Joint
2
- module InstanceMethods
3
- def grid
4
- @grid ||= Mongo::Grid.new(database)
5
- end
2
+ def grid
3
+ @grid ||= Mongo::Grid.new(database)
4
+ end
6
5
 
7
- private
8
- def assigned_attachments
9
- @assigned_attachments ||= {}
10
- end
6
+ private
7
+ def assigned_attachments
8
+ @assigned_attachments ||= {}
9
+ end
11
10
 
12
- def nil_attachments
13
- @nil_attachments ||= {}
14
- end
11
+ def nil_attachments
12
+ @nil_attachments ||= {}
13
+ end
15
14
 
16
- # IO must respond to read and rewind
17
- def save_attachments
18
- assigned_attachments.each_pair do |name, io|
19
- next unless io.respond_to?(:read)
20
- io.rewind if io.respond_to?(:rewind)
21
- grid.delete(send(name).id)
22
- grid.put(io, {
23
- :_id => send(name).id,
24
- :filename => send(name).name,
25
- :content_type => send(name).type,
26
- })
27
- end
28
- assigned_attachments.clear
15
+ # IO must respond to read and rewind
16
+ def save_attachments
17
+ assigned_attachments.each_pair do |name, io|
18
+ next unless io.respond_to?(:read)
19
+ io.rewind if io.respond_to?(:rewind)
20
+ grid.delete(send(name).id)
21
+ grid.put(io, {
22
+ :_id => send(name).id,
23
+ :filename => send(name).name,
24
+ :content_type => send(name).type,
25
+ })
29
26
  end
30
-
31
- def nullify_nil_attachments_attributes
32
- nil_attachments.each_key do |name|
33
- send(:"#{name}_id=", nil)
34
- send(:"#{name}_size=", nil)
35
- send(:"#{name}_type=", nil)
36
- send(:"#{name}_name=", nil)
37
- end
27
+ assigned_attachments.clear
28
+ end
29
+
30
+ def nullify_nil_attachments_attributes
31
+ nil_attachments.each_key do |name|
32
+ send(:"#{name}_id=", nil)
33
+ send(:"#{name}_size=", nil)
34
+ send(:"#{name}_type=", nil)
35
+ send(:"#{name}_name=", nil)
38
36
  end
37
+ end
39
38
 
40
- def destroy_nil_attachments
41
- nil_attachments.each_value do |id|
42
- grid.delete(id)
43
- end
44
-
45
- nil_attachments.clear
39
+ def destroy_nil_attachments
40
+ nil_attachments.each_value do |id|
41
+ grid.delete(id)
46
42
  end
47
43
 
48
- def destroy_all_attachments
49
- self.class.attachment_names.map { |name| grid.delete(send(name).id) }
50
- end
51
- end
44
+ nil_attachments.clear
45
+ end
46
+
47
+ def destroy_all_attachments
48
+ self.class.attachment_names.map { |name| grid.delete(send(name).id) }
49
+ end
52
50
  end
@@ -1,3 +1,3 @@
1
1
  module Joint
2
- Version = '0.6.1'
2
+ Version = '0.6.2'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joint
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Nunemaker
@@ -15,14 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-14 00:00:00 -05:00
19
- default_executable:
18
+ date: 2012-02-02 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
21
  name: wand
24
22
  prerelease: false
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
26
24
  none: false
27
25
  requirements:
28
26
  - - ~>
@@ -32,12 +30,12 @@ dependencies:
32
30
  - 0
33
31
  - 4
34
32
  version: "0.4"
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
37
33
  type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
38
36
  name: mime-types
39
37
  prerelease: false
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
41
  - - ">="
@@ -46,12 +44,12 @@ dependencies:
46
44
  segments:
47
45
  - 0
48
46
  version: "0"
49
- requirement: *id002
50
- - !ruby/object:Gem::Dependency
51
47
  type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
52
50
  name: mongo_mapper
53
51
  prerelease: false
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
55
53
  none: false
56
54
  requirements:
57
55
  - - ~>
@@ -61,7 +59,8 @@ dependencies:
61
59
  - 0
62
60
  - 9
63
61
  version: "0.9"
64
- requirement: *id003
62
+ type: :runtime
63
+ version_requirements: *id003
65
64
  description: MongoMapper and GridFS joined in file upload love.
66
65
  email: nunemaker@gmail.com
67
66
  executables: []
@@ -94,7 +93,6 @@ files:
94
93
  - test/helper.rb
95
94
  - test/joint/test_io.rb
96
95
  - test/test_joint.rb
97
- has_rdoc: true
98
96
  homepage: http://github.com/jnunemaker/joint
99
97
  licenses: []
100
98
 
@@ -124,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
122
  requirements: []
125
123
 
126
124
  rubyforge_project:
127
- rubygems_version: 1.6.1
125
+ rubygems_version: 1.8.10
128
126
  signing_key:
129
127
  specification_version: 3
130
128
  summary: MongoMapper and GridFS joined in file upload love.