has_options 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
data/has_options.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_options}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Stuart"]
@@ -33,6 +33,16 @@ module HasOptionsHash
33
33
 
34
34
  option_hash
35
35
  end
36
+
37
+ define_method "#{association_name}_hash_interned" do
38
+ result = #{association_name}_hash
39
+ result.symbolize_keys!
40
+
41
+ result.each_pair do |k,v|
42
+ result[k] = nil if v.length == 0
43
+ result[k] = v.first if v.length == 1
44
+ end
45
+ end
36
46
 
37
47
  define_method "set_#{singular_association}!" do |name, *values|
38
48
  name = name.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_options
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stuart