dg-enum_column4 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/enum/enum_adapter.rb +5 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94a59f52d6bb8ce8c0b43aefcbc9637a717ec0ad
|
4
|
+
data.tar.gz: b1dd88a2087a92c85dfba0a90d18c7a28a331509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f5364e27a5cb9fccdf519b6762fe478a6db6a170434ab0c975eded22f6a18e2f71148dea0c7b5de985885e9513b219dd58e56228ab5608b0c5a5718057244bd
|
7
|
+
data.tar.gz: b84166aa978b7401e4714a5c1075b11ed360051ea778cc49abf6b286394a461de4645ffa539d9f87136a8dd0ac5c013c59463abbf7bdb6e7344a74589c58207a
|
data/lib/enum/enum_adapter.rb
CHANGED
@@ -16,8 +16,6 @@ else
|
|
16
16
|
end
|
17
17
|
|
18
18
|
column_class.module_eval do
|
19
|
-
|
20
|
-
alias __klass_enum klass
|
21
19
|
# The class for enum is Symbol.
|
22
20
|
def klass
|
23
21
|
if type == :enum
|
@@ -26,8 +24,8 @@ column_class.module_eval do
|
|
26
24
|
__klass_enum
|
27
25
|
end
|
28
26
|
end
|
27
|
+
alias __klass_enum klass
|
29
28
|
|
30
|
-
alias __type_cast_enum type_cast
|
31
29
|
# Convert to a symbol.
|
32
30
|
def type_cast(value)
|
33
31
|
if type == :enum
|
@@ -36,9 +34,9 @@ column_class.module_eval do
|
|
36
34
|
__type_cast_enum(value)
|
37
35
|
end
|
38
36
|
end
|
37
|
+
alias __type_cast_enum type_cast
|
39
38
|
|
40
39
|
if respond_to?(:type_cast_code)
|
41
|
-
alias __type_cast_code_enum type_cast_code
|
42
40
|
# Code to convert to a symbol.
|
43
41
|
def type_cast_code(var_name)
|
44
42
|
if type == :enum
|
@@ -47,6 +45,7 @@ column_class.module_eval do
|
|
47
45
|
__type_cast_code_enum(var_name)
|
48
46
|
end
|
49
47
|
end
|
48
|
+
alias __type_cast_code_enum type_cast_code
|
50
49
|
end
|
51
50
|
|
52
51
|
class << self
|
@@ -64,7 +63,6 @@ column_class.module_eval do
|
|
64
63
|
end
|
65
64
|
|
66
65
|
private
|
67
|
-
alias __simplified_type_enum simplified_type
|
68
66
|
# The enum simple type.
|
69
67
|
def simplified_type(field_type)
|
70
68
|
if field_type =~ /enum/i
|
@@ -73,8 +71,8 @@ private
|
|
73
71
|
__simplified_type_enum(field_type)
|
74
72
|
end
|
75
73
|
end
|
74
|
+
alias __simplified_type_enum simplified_type
|
76
75
|
|
77
|
-
alias __extract_limit_enum extract_limit
|
78
76
|
def extract_limit(sql_type)
|
79
77
|
if sql_type =~ /^enum/i
|
80
78
|
sql_type.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.intern }
|
@@ -82,6 +80,6 @@ private
|
|
82
80
|
__extract_limit_enum(sql_type)
|
83
81
|
end
|
84
82
|
end
|
85
|
-
|
83
|
+
alias __extract_limit_enum extract_limit
|
86
84
|
|
87
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dg-enum_column4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pohodnya
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Enum column support for Rails 4
|
15
15
|
email:
|