haz_enum 0.5.1 → 0.5.2

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 CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -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 the gemspec command
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.1"
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-03-20}
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
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "CHANGESET",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "haz_enum.gemspec",
28
- "lib/haz_enum.rb",
29
- "lib/haz_enum/enum.rb",
30
- "lib/haz_enum/set.rb",
31
- "spec/enum_spec.rb",
32
- "spec/set_spec.rb",
33
- "spec/spec.opts",
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
- "spec/set_spec.rb",
44
- "spec/spec_helper.rb"
41
+ "spec/set_spec.rb",
42
+ "spec/spec_helper.rb"
45
43
  ]
46
44
 
47
45
  if s.respond_to? :specification_version then
@@ -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.respond_to?(:name)
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
@@ -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
- - 1
9
- version: 0.5.1
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-03-20 00:00:00 +01:00
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
- - --charset=UTF-8
91
+ rdoc_options: []
92
+
94
93
  require_paths:
95
94
  - lib
96
95
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
22
- .rake_tasks