yinum 1.7.4 → 1.7.5
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/enum/helpers/enum_attribute.rb +3 -2
- data/lib/enum/helpers/enum_column.rb +3 -2
- data/lib/enum/helpers/enum_generator.rb +2 -1
- data/lib/enum/version.rb +1 -1
- 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: 1852e8cae1da2ec57b29129ccac0e22bd10903b5
|
4
|
+
data.tar.gz: 87ab148db37f6c7681582d3224ff86775dd96518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0820b263ade12501ef425a1dd73b11f0e3623c2ee9bd7a8079f4bb33b46f5b096e018c2d4d720aeeb4194c015fa7613e063db7a76bf5903880a1adf2f32ca7
|
7
|
+
data.tar.gz: f8971edbac61a68d4c5bd792355885dfdb2755f52ee27b1478688856f63e215a8a9259dd732cdf73b46dbcea0ef282649887c71379c07ec3e511b766c91d41c7
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ module Enum::Helpers::EnumAttribute
|
|
7
7
|
# Generating attribute reader and writer to convert to EnumValue.
|
8
8
|
# If :qualifier => true, generates questioning methods for every name in the enum.
|
9
9
|
# If given a enum name (a symbol) and hash, also creates the enum.
|
10
|
-
def
|
10
|
+
def attr_yinum(attr, name_or_enum, options = {}, hash = nil)
|
11
11
|
# the first hash is either options or the hash if the options are missing
|
12
12
|
hash, options = options, {} unless name_or_enum.is_a?(Enum) or hash
|
13
13
|
# generating or getting the enum
|
@@ -15,7 +15,7 @@ module Enum::Helpers::EnumAttribute
|
|
15
15
|
e = name_or_enum
|
16
16
|
else
|
17
17
|
# generating the enum if the hash is not empty
|
18
|
-
|
18
|
+
yinum name_or_enum, hash if hash.any?
|
19
19
|
e = const_get(name_or_enum)
|
20
20
|
end
|
21
21
|
# attribute reader
|
@@ -44,6 +44,7 @@ module Enum::Helpers::EnumAttribute
|
|
44
44
|
|
45
45
|
e
|
46
46
|
end
|
47
|
+
alias_method :attr_enum, :attr_yinum
|
47
48
|
end
|
48
49
|
|
49
50
|
# Every module or class shall have it
|
@@ -8,11 +8,11 @@ module Enum::Helpers::EnumColumn
|
|
8
8
|
# Creating a validation for the attribute so it must have valid enum values (allowing nil).
|
9
9
|
# If :scoped => true, generates scopes and questioning methods for every name in the enum.
|
10
10
|
# If given a enum name (a symbol) and hash, also creates the enum.
|
11
|
-
def
|
11
|
+
def yinum_column(attr, name_or_enum, options = {}, hash = nil)
|
12
12
|
# the first hash is either options or the hash if the options are missing
|
13
13
|
hash, options = options, {} unless name_or_enum.is_a?(Enum) or hash
|
14
14
|
# generating the enum attribute
|
15
|
-
e =
|
15
|
+
e = attr_yinum(attr, name_or_enum, options.merge(:qualifier => options[:scoped]), hash)
|
16
16
|
# validation
|
17
17
|
validates_inclusion_of attr, :in => e.values, :allow_nil => true
|
18
18
|
if options[:scoped]
|
@@ -24,6 +24,7 @@ module Enum::Helpers::EnumColumn
|
|
24
24
|
|
25
25
|
e
|
26
26
|
end
|
27
|
+
alias_method :enum_column, :yinum_column
|
27
28
|
end
|
28
29
|
|
29
30
|
if defined?(ActiveRecord::Base)
|
data/lib/enum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yinum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Niv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|