coded_options 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,10 +17,14 @@ module CodedOptions
17
17
  const_set "#{singular_name}_options".upcase, to_options(values)
18
18
 
19
19
  class_eval <<-EOT, __FILE__, (__LINE__+1)
20
- def #{singular_name} # def state
21
- return unless #{singular_name}_id # return unless state_id
22
- #{plural_name.upcase}[#{singular_name}_id.to_i] # STATES[state_id.to_i]
23
- end # end
20
+ def #{singular_name} # def state
21
+ return unless #{singular_name}_id # return unless state_id
22
+ #{plural_name.upcase}[#{singular_name}_id.to_i] # STATES[state_id.to_i]
23
+ end # end
24
+
25
+ def #{singular_name}= new_value # def state= new_value
26
+ send :#{singular_name}_id=, #{plural_name.upcase}.index(new_value) # send :state_id=, STATES.index(new_value)
27
+ end # end
24
28
  EOT
25
29
  end
26
30
 
@@ -1,3 +1,3 @@
1
1
  module CodedOptions
2
- VERSION = "0.1.8"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coded_options
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Dew
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-16 00:00:00 -05:00
18
+ date: 2010-12-29 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21