has_metadata_column 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/has_metadata_column.gemspec +7 -7
- data/lib/has_metadata_column.rb +4 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: debffa2246db2ce884f4500f85d300c689eb2e3e
|
4
|
+
data.tar.gz: 38034ef695d113031ed7f1a0315610a289fbfcab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ff61edba08a1dcd6b82d25eff7dd667f4b728ea16c9f77e84cbdd37f1de909ac349fa168e4a10e0b61f0fb9419732470b83556a6906b883ef85eb0a5d554b9a
|
7
|
+
data.tar.gz: 4cb81019ae854f1c6114d411e2a07c9ae7c83e4d7d7b81569e2169f21d9e3b8dd8d285556f442538b165e80df0e48f40047b83bfc37a699dbb52769676902333
|
data/has_metadata_column.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: has_metadata_column 1.1.
|
5
|
+
# stub: has_metadata_column 1.1.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "has_metadata_column".freeze
|
9
|
-
s.version = "1.1.
|
9
|
+
s.version = "1.1.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Tim Morgan".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2017-05-09"
|
15
15
|
s.description = "Reduce your table width and migration overhead by moving non-indexed columns to a separate metadata column.".freeze
|
16
16
|
s.email = "git@timothymorgan.info".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -26,14 +26,14 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.homepage = "http://github.com/riscfuture/has_metadata_column".freeze
|
27
27
|
s.licenses = ["MIT".freeze]
|
28
28
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9".freeze)
|
29
|
-
s.rubygems_version = "2.6.
|
29
|
+
s.rubygems_version = "2.6.12".freeze
|
30
30
|
s.summary = "Schemaless metadata using JSON columns".freeze
|
31
31
|
|
32
32
|
if s.respond_to? :specification_version then
|
33
33
|
s.specification_version = 4
|
34
34
|
|
35
35
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
36
|
-
s.add_runtime_dependency(%q<rails>.freeze, [">= 5.
|
36
|
+
s.add_runtime_dependency(%q<rails>.freeze, [">= 5.1"])
|
37
37
|
s.add_runtime_dependency(%q<boolean>.freeze, [">= 0"])
|
38
38
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
39
39
|
s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
43
43
|
s.add_development_dependency(%q<activemodel-serializers-xml>.freeze, [">= 0"])
|
44
44
|
else
|
45
|
-
s.add_dependency(%q<rails>.freeze, [">= 5.
|
45
|
+
s.add_dependency(%q<rails>.freeze, [">= 5.1"])
|
46
46
|
s.add_dependency(%q<boolean>.freeze, [">= 0"])
|
47
47
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
48
48
|
s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
|
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
|
|
52
52
|
s.add_dependency(%q<activemodel-serializers-xml>.freeze, [">= 0"])
|
53
53
|
end
|
54
54
|
else
|
55
|
-
s.add_dependency(%q<rails>.freeze, [">= 5.
|
55
|
+
s.add_dependency(%q<rails>.freeze, [">= 5.1"])
|
56
56
|
s.add_dependency(%q<boolean>.freeze, [">= 0"])
|
57
57
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
58
58
|
s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
|
data/lib/has_metadata_column.rb
CHANGED
@@ -22,7 +22,7 @@ module HasMetadataColumn
|
|
22
22
|
included { prepend Extensions }
|
23
23
|
|
24
24
|
# Valid values for the `:type` option.
|
25
|
-
TYPES = [String,
|
25
|
+
TYPES = [String, Integer, Float, Hash, Array, TrueClass, FalseClass, Boolean, NilClass, Date, Time]
|
26
26
|
|
27
27
|
# @private
|
28
28
|
def self.metadata_typecast(value, type=nil)
|
@@ -30,7 +30,7 @@ module HasMetadataColumn
|
|
30
30
|
raise ArgumentError, "Can't convert objects of type #{type.to_s}" unless TYPES.include?(type)
|
31
31
|
|
32
32
|
if value.kind_of?(String) then
|
33
|
-
if type == Integer
|
33
|
+
if type == Integer then
|
34
34
|
begin
|
35
35
|
return Integer(value.sub(/^0+/, '')) # so that it doesn't think it's in octal
|
36
36
|
rescue ArgumentError
|
@@ -118,6 +118,8 @@ module HasMetadataColumn
|
|
118
118
|
type_validate = !options.delete(:skip_type_validation)
|
119
119
|
options.delete :default
|
120
120
|
|
121
|
+
attribute name
|
122
|
+
|
121
123
|
validate do |obj|
|
122
124
|
value = obj.send(name)
|
123
125
|
if !HasMetadataColumn.metadata_typecast(value, type).kind_of?(type) &&
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_metadata_column
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
26
|
+
version: '5.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: boolean
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.6.
|
158
|
+
rubygems_version: 2.6.12
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Schemaless metadata using JSON columns
|