enumerated_attribute 0.2.7 → 0.2.8
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.
- data/README.rdoc +13 -15
- data/lib/enumerated_attribute/attribute/instance_methods.rb +3 -3
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -20,35 +20,33 @@ Install
|
|
20
20
|
|
21
21
|
== Notice
|
22
22
|
|
23
|
-
Not yet Rails3 compliant
|
23
|
+
Not yet Rails3 compliant -- but getting close. Stay tuned.
|
24
24
|
|
25
25
|
== How to submit an Issue
|
26
26
|
|
27
27
|
If something needs fixed, please submit issues to this Github project in the Issues tab and
|
28
28
|
provide a series of FAILING RSPEC files that I can drop into the current RSpec
|
29
29
|
test framework and run with little to no coersing. Thanks.
|
30
|
+
|
31
|
+
== Contributors
|
32
|
+
|
33
|
+
* Lailson Bandeira - Rails 3 updates
|
30
34
|
|
31
35
|
== Description
|
32
36
|
|
33
|
-
|
34
|
-
enumerated attributes are implemented with strings, symbols or constants. Often the
|
37
|
+
Typically, in Ruby, enumerated attributes are implemented with strings, symbols or constants. Often the
|
35
38
|
developer is burdened with repeatedly defining common methods in support of each
|
36
|
-
attribute.
|
37
|
-
|
38
|
-
|
39
|
-
convention and DRYing the implementation. Repetitive code such as initializers, accessors,
|
40
|
-
predicate and enumeration methods are automatically generated, resulting in better
|
41
|
-
encapsulation, quicker implementation and cleaner code.
|
39
|
+
attribute. +enumerated_attribute+ provides a DRY implementation for enumerations in Rails.
|
40
|
+
Repetitive code such as initializers, accessors, predicate and enumeration methods are automatically generated
|
41
|
+
along with the following features:
|
42
42
|
|
43
|
-
Features include:
|
44
43
|
* ActiveRecord integration
|
45
44
|
* ActionView form helpers
|
46
45
|
* Scaffold generator integration
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
*
|
51
|
-
* Advanced configuration DSL
|
46
|
+
* Definable enumeration labels
|
47
|
+
* Enum helper methods
|
48
|
+
* Syntactical predicate methods
|
49
|
+
* Initialization
|
52
50
|
|
53
51
|
== Setup
|
54
52
|
|
@@ -3,13 +3,13 @@ module EnumeratedAttribute
|
|
3
3
|
module InstanceMethods
|
4
4
|
def self.included(base)
|
5
5
|
|
6
|
-
method_missing_suffix = "enumerated_attribute_#{base.name}_#{base.hash}".to_sym
|
6
|
+
method_missing_suffix = "enumerated_attribute_#{base.name.gsub(/^.+>::/,'')}_#{base.hash.abs}".to_sym
|
7
7
|
define_method("method_missing_with_#{method_missing_suffix}") do |methId, *args|
|
8
8
|
return self.__send__(methId) if define_enumerated_attribute_dynamic_method(methId)
|
9
9
|
self.__send__("method_missing_without_#{method_missing_suffix}", methId, *args)
|
10
10
|
end
|
11
11
|
|
12
|
-
respond_to_suffix = "enumerated_attribute_#{base.name}_#{base.hash}".to_sym
|
12
|
+
respond_to_suffix = "enumerated_attribute_#{base.name.gsub(/^.+>::/,'')}_#{base.hash.abs}".to_sym
|
13
13
|
base.class_eval %{
|
14
14
|
def respond_to_with_#{respond_to_suffix}?(method, include_private=false)
|
15
15
|
self.respond_to_without_#{respond_to_suffix}?(method, include_private) ||
|
@@ -93,4 +93,4 @@ module EnumeratedAttribute
|
|
93
93
|
|
94
94
|
end
|
95
95
|
end
|
96
|
-
end
|
96
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 8
|
9
|
+
version: 0.2.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeff Patmon
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-24 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|