yinum 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- 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 +9 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91dd035ae18c028a192338197d8a66f85446f230
|
4
|
+
data.tar.gz: f2f97cb348e34639a03775b4e7106b05f455bf2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ff43e20151586d1eb18e8b59b4619aebe1038e3813515bd24c4ff3ca374800e3b92d1e5e93dbde62925aaa13a16c81df027dc9895179ba6c74d44480958b424
|
7
|
+
data.tar.gz: b19b884b6c0e0e87b795fcfd16aa3662ca80eef65ab1c1095d7f1df3f00f1de12592e1c89d305fa29407e250cc0ee6af1988578e712f55465722d6abd8741127
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
**1.8.1**
|
2
|
+
* Oops, merge 1.7.5 into 1.8.
|
3
|
+
|
1
4
|
**1.8.0**
|
2
5
|
* `Enum#options` now return the mapping of translations to their corresponding
|
3
6
|
values rather than their names. Works better with `FormBuilder`.
|
4
7
|
|
8
|
+
**1.7.5**
|
9
|
+
* Alias helper methods to support Rails 4.1 overriding `::enum`.
|
10
|
+
|
5
11
|
**1.7.4**
|
6
12
|
* `attr_enum`'s reader allows super to hold the name etc.
|
7
13
|
* Add `#attr_enum` and `#enum` only to modules and classes (not any instance).
|
@@ -24,4 +30,3 @@
|
|
24
30
|
* `attr_enum` reader always returns an EnumValue.
|
25
31
|
* `EnumValue#t` uses `String#titlelize` if it's available and I18n or the
|
26
32
|
specific translation are not available.
|
27
|
-
|
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,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yinum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
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-04
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: Yummy implementation of enum that gives integer values with a special
|
@@ -32,7 +32,7 @@ executables: []
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
-
-
|
35
|
+
- .gitignore
|
36
36
|
- CHANGELOG.md
|
37
37
|
- Gemfile
|
38
38
|
- Gemfile.lock
|
@@ -64,24 +64,18 @@ require_paths:
|
|
64
64
|
- lib
|
65
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project: yinum
|
77
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.0.3
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Enum implementation
|
81
|
-
test_files:
|
82
|
-
- spec/lib/enum/enum_value_spec.rb
|
83
|
-
- spec/lib/enum/helpers/enum_attribute_spec.rb
|
84
|
-
- spec/lib/enum/helpers/enum_column_spec.rb
|
85
|
-
- spec/lib/enum/helpers/enum_generator_spec.rb
|
86
|
-
- spec/lib/enum_spec.rb
|
87
|
-
- spec/spec_helper.rb
|
81
|
+
test_files: []
|