has_metadata 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -37,7 +37,7 @@ GEM
37
37
  abstract (>= 1.0.0)
38
38
  git (1.2.5)
39
39
  i18n (0.5.0)
40
- jeweler (1.6.2)
40
+ jeweler (1.6.4)
41
41
  bundler (~> 1.0)
42
42
  git (>= 1.2.5)
43
43
  rake
@@ -68,7 +68,7 @@ GEM
68
68
  rdoc (~> 3.4)
69
69
  thor (~> 0.14.4)
70
70
  rake (0.9.2)
71
- rdoc (3.6.1)
71
+ rdoc (3.8)
72
72
  rspec (2.6.0)
73
73
  rspec-core (~> 2.6.0)
74
74
  rspec-expectations (~> 2.6.0)
@@ -81,7 +81,7 @@ GEM
81
81
  thor (0.14.6)
82
82
  treetop (1.4.9)
83
83
  polyglot (>= 0.3.1)
84
- tzinfo (0.3.28)
84
+ tzinfo (0.3.29)
85
85
  yard (0.7.2)
86
86
 
87
87
  PLATFORMS
data/README.textile CHANGED
@@ -1,7 +1,7 @@
1
1
  h1. has_metadata -- Keep your tables narrow
2
2
 
3
3
  | *Author* | Tim Morgan |
4
- | *Version* | 1.2 (Jun 20, 2011) |
4
+ | *Version* | 1.2.1 (Jul 16, 2011) |
5
5
  | *License* | Released under the MIT License. |
6
6
 
7
7
  h2. Important note for those upgrading from 1.0 to 1.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
data/has_metadata.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_metadata}
8
- s.version = "1.2.0"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Tim Morgan}]
12
- s.date = %q{2011-06-21}
11
+ s.authors = ["Tim Morgan"]
12
+ s.date = %q{2011-07-16}
13
13
  s.description = %q{has_metadata lets you move non-indexed and weighty columns off of your big tables by creating a separate metadata table to store all this extra information. Works with Ruby 1.9. and Rails 3.0.}
14
14
  s.email = %q{git@timothymorgan.info}
15
15
  s.extra_rdoc_files = [
@@ -36,9 +36,9 @@ Gem::Specification.new do |s|
36
36
  "templates/metadata.rb"
37
37
  ]
38
38
  s.homepage = %q{http://github.com/riscfuture/has_metadata}
39
- s.require_paths = [%q{lib}]
39
+ s.require_paths = ["lib"]
40
40
  s.required_ruby_version = Gem::Requirement.new(">= 1.9")
41
- s.rubygems_version = %q{1.8.5}
41
+ s.rubygems_version = %q{1.6.2}
42
42
  s.summary = %q{Reduce your table width by moving non-indexed columns to a separate metadata table}
43
43
 
44
44
  if s.respond_to? :specification_version then
data/lib/has_metadata.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'has_metadata/metadata_generator'
2
2
  require 'has_metadata/model'
3
+ require 'boolean'
3
4
 
4
5
  # @private
5
6
  class Object
@@ -133,5 +134,10 @@ module HasMetadata
133
134
  end
134
135
  end
135
136
  end
137
+
138
+ # @private
139
+ def inspect
140
+ "#<#{self.class.to_s} #{attributes.merge(metadata.try(:data).try(:stringify_keys) || {}).map { |k,v| "#{k}: #{v.inspect}" }.join(', ')}>"
141
+ end
136
142
  end
137
143
  end
@@ -72,7 +72,7 @@ module HasMetadata
72
72
  end
73
73
 
74
74
  def nullify_empty_fields
75
- data.each { |key, value| data[key] = nil if value.blank? }
75
+ data.each { |key, value| data[key] = nil if value == "" }
76
76
  end
77
77
  end
78
78
  end
@@ -9,5 +9,13 @@ describe Metadata do
9
9
  it "should initialize data to the value given in the initializer" do
10
10
  Metadata.new(data: { foo: 'bar' }).data.should eql(foo: 'bar')
11
11
  end
12
+
13
+ it "should set empty strings to nil" do
14
+ Metadata.create!(data: { foo: '' }).data.should eql(foo: nil)
15
+ end
16
+
17
+ it "should not set false values to nil" do
18
+ Metadata.create!(data: { foo: false }).data.should eql(foo: false)
19
+ end
12
20
  end
13
21
  end
metadata CHANGED
@@ -1,104 +1,104 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: has_metadata
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
4
5
  prerelease:
5
- version: 1.2.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Tim Morgan
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-21 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-07-16 00:00:00.000000000 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2152152740 !ruby/object:Gem::Requirement
18
18
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "3.0"
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *2152152740
26
+ - !ruby/object:Gem::Dependency
27
27
  name: boolean
28
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirement: &2152152160 !ruby/object:Gem::Requirement
29
29
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *2152152160
37
+ - !ruby/object:Gem::Dependency
38
38
  name: jeweler
39
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ requirement: &2152151560 !ruby/object:Gem::Requirement
40
40
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *2152151560
48
+ - !ruby/object:Gem::Dependency
49
49
  name: yard
50
- requirement: &id004 !ruby/object:Gem::Requirement
50
+ requirement: &2152150960 !ruby/object:Gem::Requirement
51
51
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
58
+ version_requirements: *2152150960
59
+ - !ruby/object:Gem::Dependency
60
60
  name: RedCloth
61
- requirement: &id005 !ruby/object:Gem::Requirement
61
+ requirement: &2152150440 !ruby/object:Gem::Requirement
62
62
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
69
+ version_requirements: *2152150440
70
+ - !ruby/object:Gem::Dependency
71
71
  name: sqlite3
72
- requirement: &id006 !ruby/object:Gem::Requirement
72
+ requirement: &2152149900 !ruby/object:Gem::Requirement
73
73
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
80
+ version_requirements: *2152149900
81
+ - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
- requirement: &id007 !ruby/object:Gem::Requirement
83
+ requirement: &2152149420 !ruby/object:Gem::Requirement
84
84
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: "0"
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *id007
92
- description: has_metadata lets you move non-indexed and weighty columns off of your big tables by creating a separate metadata table to store all this extra information. Works with Ruby 1.9. and Rails 3.0.
91
+ version_requirements: *2152149420
92
+ description: has_metadata lets you move non-indexed and weighty columns off of your
93
+ big tables by creating a separate metadata table to store all this extra information.
94
+ Works with Ruby 1.9. and Rails 3.0.
93
95
  email: git@timothymorgan.info
94
96
  executables: []
95
-
96
97
  extensions: []
97
-
98
- extra_rdoc_files:
98
+ extra_rdoc_files:
99
99
  - LICENSE
100
100
  - README.textile
101
- files:
101
+ files:
102
102
  - .document
103
103
  - .rspec
104
104
  - Gemfile
@@ -116,32 +116,30 @@ files:
116
116
  - spec/spec_helper.rb
117
117
  - templates/create_metadata.rb
118
118
  - templates/metadata.rb
119
+ has_rdoc: true
119
120
  homepage: http://github.com/riscfuture/has_metadata
120
121
  licenses: []
121
-
122
122
  post_install_message:
123
123
  rdoc_options: []
124
-
125
- require_paths:
124
+ require_paths:
126
125
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
126
+ required_ruby_version: !ruby/object:Gem::Requirement
128
127
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: "1.9"
133
- required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '1.9'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
133
  none: false
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: "0"
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
139
138
  requirements: []
140
-
141
139
  rubyforge_project:
142
- rubygems_version: 1.8.5
140
+ rubygems_version: 1.6.2
143
141
  signing_key:
144
142
  specification_version: 3
145
- summary: Reduce your table width by moving non-indexed columns to a separate metadata table
143
+ summary: Reduce your table width by moving non-indexed columns to a separate metadata
144
+ table
146
145
  test_files: []
147
-