enumerated_attribute 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/lib/enumerated_attribute/attribute.rb +1 -0
- data/lib/enumerated_attribute/attribute/class_methods.rb +3 -0
- data/spec/poro_spec.rb +11 -0
- metadata +11 -4
data/README.rdoc
CHANGED
@@ -22,6 +22,8 @@ Install
|
|
22
22
|
|
23
23
|
Not yet Rails3 compliant -- but getting close. Stay tuned.
|
24
24
|
|
25
|
+
Be a good coder ... get state pattern support for your enumerated attributes (enumerated_state[http://github.com/jeffp/enumerated_state])
|
26
|
+
|
25
27
|
== How to submit an Issue
|
26
28
|
|
27
29
|
If something needs fixed, please submit issues to this Github project in the Issues tab and
|
@@ -47,6 +49,7 @@ along with the following features:
|
|
47
49
|
* Enum helper methods
|
48
50
|
* Syntactical predicate methods
|
49
51
|
* Initialization
|
52
|
+
* State pattern support (enumerated_state[http://github.com/jeffp/enumerated_state])
|
50
53
|
|
51
54
|
== Setup
|
52
55
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module EnumeratedAttribute
|
2
2
|
module Attribute
|
3
3
|
module ClassMethods
|
4
|
+
def refresh_enumerated_attributes
|
5
|
+
@all_enumerated_attributes_cache = nil
|
6
|
+
end
|
4
7
|
def enumerated_attributes(all=true)
|
5
8
|
return @enumerated_attributes unless all
|
6
9
|
return @all_enumerated_attributes_cache if @all_enumerated_attributes_cache
|
data/spec/poro_spec.rb
CHANGED
@@ -12,6 +12,17 @@ Spec::Matchers.define :define_instance_method do |method_name|
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
describe "enumerated_attributes caching" do
|
16
|
+
class Impl1
|
17
|
+
enum_attr :enum1, %w(e1 e2)
|
18
|
+
enumerated_attributes
|
19
|
+
enum_attr :enum2, %w(e3 e4)
|
20
|
+
end
|
21
|
+
it "should have enum2 described even though enumerated_attributes cached state" do
|
22
|
+
obj = Impl1.new
|
23
|
+
lambda { obj.enum2 = :e3 }.should_not raise_exception
|
24
|
+
end
|
25
|
+
end
|
15
26
|
describe "Plural" do
|
16
27
|
it "should have plural accessor :boxes for :box" do
|
17
28
|
p=Plural.new
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerated_attribute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 12
|
10
|
+
version: 0.2.12
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Jeff Patmon
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-29 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: meta_programming
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 21
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 2
|
@@ -155,23 +158,27 @@ rdoc_options: []
|
|
155
158
|
require_paths:
|
156
159
|
- lib
|
157
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
158
162
|
requirements:
|
159
163
|
- - ">="
|
160
164
|
- !ruby/object:Gem::Version
|
165
|
+
hash: 3
|
161
166
|
segments:
|
162
167
|
- 0
|
163
168
|
version: "0"
|
164
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
165
171
|
requirements:
|
166
172
|
- - ">="
|
167
173
|
- !ruby/object:Gem::Version
|
174
|
+
hash: 3
|
168
175
|
segments:
|
169
176
|
- 0
|
170
177
|
version: "0"
|
171
178
|
requirements: []
|
172
179
|
|
173
180
|
rubyforge_project:
|
174
|
-
rubygems_version: 1.3.
|
181
|
+
rubygems_version: 1.3.7
|
175
182
|
signing_key:
|
176
183
|
specification_version: 3
|
177
184
|
summary: Add enumerated attributes to your models and expose them in drop-down lists in your views
|