comma 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- comma (3.2.3)
4
+ comma (3.2.4)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -3,19 +3,16 @@ require 'comma/data_extractor'
3
3
  require 'comma/header_extractor'
4
4
 
5
5
  class Object
6
+ class_attribute :comma_formats
7
+
6
8
  class << self
7
9
  def comma(style = :default, &block)
8
- (@comma_formats ||= {})[style] = block
10
+ (self.comma_formats ||= {})[style] = block
9
11
  end
10
12
 
11
- def comma_formats
12
- @comma_formats ||= begin
13
- if self == Object
14
- {}
15
- else
16
- self.superclass.comma_formats
17
- end
18
- end
13
+ def inherited(subclass)
14
+ super
15
+ subclass.comma_formats = self.comma_formats ? self.comma_formats.dup : {}
19
16
  end
20
17
  end
21
18
 
@@ -31,12 +28,10 @@ class Object
31
28
 
32
29
  def extract_with(extractor_class, style = :default)
33
30
  raise_unless_style_exists(style)
34
- formats = respond_to?(:comma_formats) ? self.comma_formats : self.class.comma_formats
35
- extractor_class.new(self, style, formats).results
31
+ extractor_class.new(self, style, self.comma_formats).results
36
32
  end
37
33
 
38
34
  def raise_unless_style_exists(style)
39
- formats = respond_to?(:comma_formats) ? self.comma_formats : self.class.comma_formats
40
- raise "No comma format for class #{self.class} defined for style #{style}" unless formats && formats[style]
35
+ raise "No comma format for class #{self.class} defined for style #{style}" unless self.comma_formats && self.comma_formats[style]
41
36
  end
42
37
  end
@@ -1,3 +1,3 @@
1
1
  module Comma
2
- VERSION = '3.2.3'
2
+ VERSION = '3.2.4'
3
3
  end
@@ -16,7 +16,8 @@ describe Comma do
16
16
 
17
17
  describe '.to_comma_header' do
18
18
  it 'should not crash (#94)' do
19
- klass = Class.new do
19
+ klass = Class.new
20
+ klass.instance_eval do
20
21
  attr_accessor :name
21
22
 
22
23
  comma :brief do
@@ -150,13 +150,17 @@ if defined? ActiveRecord
150
150
  end
151
151
 
152
152
  describe Comma, 'generating CSV from an ActiveRecord object using Single Table Inheritance' do
153
-
154
153
  class Animal < ActiveRecord::Base
155
- comma do;
154
+ comma do
156
155
  name 'Name' do |name|
157
156
  'Super-' + name
158
157
  end
159
158
  end
159
+
160
+ comma :with_type do
161
+ name
162
+ type
163
+ end
160
164
  end
161
165
 
162
166
  class Dog < Animal
@@ -192,6 +196,8 @@ if defined? ActiveRecord
192
196
  @cat.to_comma.should == %w(Super-Kitty)
193
197
  end
194
198
 
199
+ it 'should call definion in parent class' do
200
+ lambda { @dog.to_comma(:with_type) }.should_not raise_error
201
+ end
195
202
  end
196
-
197
203
  end
metadata CHANGED
@@ -1,98 +1,119 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: comma
3
- version: !ruby/object:Gem::Version
4
- version: 3.2.3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 7
5
+ prerelease:
6
+ segments:
7
+ - 3
8
+ - 2
9
+ - 4
10
+ version: 3.2.4
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Marcus Crafter
8
14
  - Tom Meier
9
15
  autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
- date: 2015-04-05 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: activesupport
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
+
19
+ date: 2015-04-08 00:00:00 +09:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
18
26
  - - ">="
19
- - !ruby/object:Gem::Version
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ - 0
20
33
  version: 3.0.0
21
34
  type: :runtime
35
+ version_requirements: *id001
22
36
  prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 3.0.0
28
- - !ruby/object:Gem::Dependency
29
- name: appraisal
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
37
+ name: activesupport
38
+ - !ruby/object:Gem::Dependency
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 13
45
+ segments:
46
+ - 0
47
+ - 4
48
+ - 1
34
49
  version: 0.4.1
35
50
  type: :development
51
+ version_requirements: *id002
36
52
  prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: 0.4.1
42
- - !ruby/object:Gem::Dependency
43
- name: rake
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
53
+ name: appraisal
54
+ - !ruby/object:Gem::Dependency
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 63
61
+ segments:
62
+ - 0
63
+ - 9
64
+ - 2
48
65
  version: 0.9.2
49
66
  type: :development
67
+ version_requirements: *id003
50
68
  prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: 0.9.2
56
- - !ruby/object:Gem::Dependency
57
- name: rspec
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
69
+ name: rake
70
+ - !ruby/object:Gem::Dependency
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 47
77
+ segments:
78
+ - 2
79
+ - 8
80
+ - 0
62
81
  version: 2.8.0
63
82
  type: :development
83
+ version_requirements: *id004
64
84
  prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: 2.8.0
70
- - !ruby/object:Gem::Dependency
71
- name: sqlite3
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
85
+ name: rspec
86
+ - !ruby/object:Gem::Dependency
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 19
93
+ segments:
94
+ - 1
95
+ - 3
96
+ - 4
76
97
  version: 1.3.4
77
98
  type: :development
99
+ version_requirements: *id005
78
100
  prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: 1.3.4
101
+ name: sqlite3
84
102
  description: Ruby Comma Seperated Values generation library
85
- email:
103
+ email:
86
104
  - crafterm@redartisan.com
87
105
  - tom@venombytes.com
88
106
  executables: []
107
+
89
108
  extensions: []
109
+
90
110
  extra_rdoc_files: []
91
- files:
92
- - ".coveralls.yml"
93
- - ".gitignore"
94
- - ".rspec"
95
- - ".travis.yml"
111
+
112
+ files:
113
+ - .coveralls.yml
114
+ - .gitignore
115
+ - .rspec
116
+ - .travis.yml
96
117
  - Appraisals
97
118
  - Gemfile
98
119
  - Gemfile.lock
@@ -154,31 +175,41 @@ files:
154
175
  - spec/rails_app/mongoid/config.rb
155
176
  - spec/rails_app/rails_app.rb
156
177
  - spec/spec_helper.rb
178
+ has_rdoc: true
157
179
  homepage: http://github.com/crafterm/comma
158
- licenses:
180
+ licenses:
159
181
  - MIT
160
- metadata: {}
161
182
  post_install_message:
162
183
  rdoc_options: []
163
- require_paths:
184
+
185
+ require_paths:
164
186
  - lib
165
- required_ruby_version: !ruby/object:Gem::Requirement
166
- requirements:
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
167
190
  - - ">="
168
- - !ruby/object:Gem::Version
169
- version: '0'
170
- required_rubygems_version: !ruby/object:Gem::Requirement
171
- requirements:
191
+ - !ruby/object:Gem::Version
192
+ hash: 3
193
+ segments:
194
+ - 0
195
+ version: "0"
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ none: false
198
+ requirements:
172
199
  - - ">="
173
- - !ruby/object:Gem::Version
174
- version: '0'
200
+ - !ruby/object:Gem::Version
201
+ hash: 3
202
+ segments:
203
+ - 0
204
+ version: "0"
175
205
  requirements: []
206
+
176
207
  rubyforge_project: comma
177
- rubygems_version: 2.2.2
208
+ rubygems_version: 1.6.2
178
209
  signing_key:
179
- specification_version: 4
210
+ specification_version: 3
180
211
  summary: Ruby Comma Seperated Values generation library
181
- test_files:
212
+ test_files:
182
213
  - spec/comma/comma_spec.rb
183
214
  - spec/comma/data_extractor_spec.rb
184
215
  - spec/comma/header_extractor_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: ca042f6a9bdf1e47e62d1829ae1cc6aca549eb2f
4
- data.tar.gz: 47882ea5eaa37cc7573e78bfaff111b666c162ae
5
- SHA512:
6
- metadata.gz: f1e3d9ce1e135e3b5d45c2b1ac38c6a8d65f1811ed3a98a082a6050eab8bc413417e022457dd154db5877305d52fa277c1194ed3336ddedc05ed80698da66b80
7
- data.tar.gz: 3515fae45105eb8b688071fbd03e2e2b9b1d594551772f09c7c4decce1c43455123ae59930ac4b2623d3313344b4f84e4751208b1d188b5841561f78506e057b