enum_attr 0.0.5 → 0.0.6
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/VERSION +1 -1
- data/enum_attr.gemspec +2 -2
- data/lib/enum_attr.rb +14 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/enum_attr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{enum_attr}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["qichunren"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-28}
|
13
13
|
s.description = %q{A Rails plugin which brings easy-to-use enum-like functionality to ActiveRecord models (now compatible with rails 3, ruby 1.9 and jruby). .}
|
14
14
|
s.email = %q{whyruby@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/enum_attr.rb
CHANGED
@@ -35,10 +35,16 @@ module EnumAttr
|
|
35
35
|
# TODO: how to judge if there is active_record 3 gem here?
|
36
36
|
scope "#{attr}_#{enum[2]}".to_sym, where("#{attr}=#{enum[1]}")
|
37
37
|
|
38
|
-
# TODO define_method such as "stauts_origin?"
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
# # TODO define_method such as "stauts_origin?"
|
39
|
+
# why does this get error result?
|
40
|
+
# define_method "#{attr}_#{enum[2]}?" do
|
41
|
+
# attr == enum[1]
|
42
|
+
# end
|
43
|
+
class_eval(%Q{
|
44
|
+
def #{attr}_#{enum[2]}?
|
45
|
+
#{attr} == #{enum[1]}
|
46
|
+
end
|
47
|
+
})
|
42
48
|
|
43
49
|
end # end: enums.each
|
44
50
|
|
@@ -55,8 +61,11 @@ end
|
|
55
61
|
def #{attr}_name
|
56
62
|
ENUMS_#{attr.upcase}.find{|option| option[1] == #{attr}}[0] unless #{attr}.nil?
|
57
63
|
end
|
58
|
-
|
64
|
+
|
65
|
+
})
|
59
66
|
end
|
67
|
+
|
68
|
+
|
60
69
|
end
|
61
70
|
end
|
62
71
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- qichunren
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-28 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|