enumerize 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/lib/enumerize/integrations/basic.rb +4 -4
- data/lib/enumerize/version.rb +1 -1
- data/test/activerecord_test.rb +1 -0
- metadata +5 -5
data/CHANGELOG.md
CHANGED
@@ -37,8 +37,8 @@ module Enumerize
|
|
37
37
|
def _define_enumerize_attribute(mod, attr)
|
38
38
|
mod.module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
39
39
|
def #{attr.name}
|
40
|
-
if
|
41
|
-
self.class.#{attr.name}.find_value(
|
40
|
+
if respond_to?(:read_attribute, true)
|
41
|
+
self.class.#{attr.name}.find_value(read_attribute(:#{attr.name}))
|
42
42
|
else
|
43
43
|
if defined?(@#{attr.name})
|
44
44
|
self.class.#{attr.name}.find_value(@#{attr.name})
|
@@ -49,8 +49,8 @@ module Enumerize
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def #{attr.name}=(new_value)
|
52
|
-
if
|
53
|
-
|
52
|
+
if respond_to?(:write_attribute, true)
|
53
|
+
write_attribute :#{attr.name}, self.class.#{attr.name}.find_value(new_value).to_s
|
54
54
|
else
|
55
55
|
@#{attr.name} = self.class.#{attr.name}.find_value(new_value).to_s
|
56
56
|
end
|
data/lib/enumerize/version.rb
CHANGED
data/test/activerecord_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &22484160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22484160
|
25
25
|
description: Enumerated attributes with I18n and ActiveRecord support
|
26
26
|
email: info@twinslash.com
|
27
27
|
executables: []
|
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash:
|
66
|
+
hash: 375391047734641899
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash:
|
75
|
+
hash: 375391047734641899
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
78
|
rubygems_version: 1.8.15
|