haz_enum 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/haz_enum.gemspec +19 -21
- data/lib/haz_enum/enum.rb +3 -1
- data/spec/enum_spec.rb +5 -0
- metadata +5 -6
- data/.gitignore +0 -22
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/haz_enum.gemspec
CHANGED
@@ -1,47 +1,45 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{haz_enum}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["thyphoon"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-05-12}
|
13
13
|
s.description = %q{use has_set and has_enum in your ActiveRecord models if you want to have one (has_enum) value from a defined enumeration or more (has_set))}
|
14
14
|
s.email = %q{andi@galaxycats.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"spec/spec_helper.rb"
|
21
|
+
"CHANGESET",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"haz_enum.gemspec",
|
27
|
+
"lib/haz_enum.rb",
|
28
|
+
"lib/haz_enum/enum.rb",
|
29
|
+
"lib/haz_enum/set.rb",
|
30
|
+
"spec/enum_spec.rb",
|
31
|
+
"spec/set_spec.rb",
|
32
|
+
"spec/spec.opts",
|
33
|
+
"spec/spec_helper.rb"
|
35
34
|
]
|
36
35
|
s.homepage = %q{http://github.com/galaxycats/haz_enum}
|
37
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
38
36
|
s.require_paths = ["lib"]
|
39
37
|
s.rubygems_version = %q{1.3.6}
|
40
38
|
s.summary = %q{has_set and has_enum for ActiveRecord}
|
41
39
|
s.test_files = [
|
42
40
|
"spec/enum_spec.rb",
|
43
|
-
|
44
|
-
|
41
|
+
"spec/set_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
45
43
|
]
|
46
44
|
|
47
45
|
if s.respond_to? :specification_version then
|
data/lib/haz_enum/enum.rb
CHANGED
@@ -18,7 +18,9 @@ module HazEnum
|
|
18
18
|
end
|
19
19
|
|
20
20
|
define_method "#{enum_name}=" do |enum_to_set|
|
21
|
-
if enum_to_set.
|
21
|
+
if enum_to_set.blank?
|
22
|
+
self["#{enum_column}"] = nil
|
23
|
+
elsif enum_to_set.respond_to?(:name)
|
22
24
|
self["#{enum_column}"] = enum_to_set.name
|
23
25
|
else
|
24
26
|
self["#{enum_column}"] = enum_class.const_get(enum_to_set).name
|
data/spec/enum_spec.rb
CHANGED
@@ -70,6 +70,11 @@ describe "HazEnum" do
|
|
70
70
|
role_enum.has_module_role?(ModuleRoles::Admin).should == true
|
71
71
|
end
|
72
72
|
|
73
|
+
it "should handle blank parameter of setter" do
|
74
|
+
ClassWithEnum.new(:product => nil).product.should be_nil
|
75
|
+
ClassWithEnum.new(:product => "").product.should be_nil
|
76
|
+
end
|
77
|
+
|
73
78
|
after(:all) do
|
74
79
|
teardown_db
|
75
80
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 2
|
9
|
+
version: 0.5.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- thyphoon
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-05-12 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -70,7 +70,6 @@ extra_rdoc_files:
|
|
70
70
|
- README.rdoc
|
71
71
|
files:
|
72
72
|
- .document
|
73
|
-
- .gitignore
|
74
73
|
- CHANGESET
|
75
74
|
- LICENSE
|
76
75
|
- README.rdoc
|
@@ -89,8 +88,8 @@ homepage: http://github.com/galaxycats/haz_enum
|
|
89
88
|
licenses: []
|
90
89
|
|
91
90
|
post_install_message:
|
92
|
-
rdoc_options:
|
93
|
-
|
91
|
+
rdoc_options: []
|
92
|
+
|
94
93
|
require_paths:
|
95
94
|
- lib
|
96
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|