active_enum 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,10 +7,6 @@ require 'lib/active_enum/version'
7
7
 
8
8
  GEM_NAME = "active_enum"
9
9
  GEM_VERSION = ActiveEnum::VERSION
10
- AUTHOR = "Adam Meehan"
11
- EMAIL = "adam.meehan@gmail.com"
12
- HOMEPAGE = "http://github.com/adzap/active_enum"
13
- SUMMARY = "Define enum classes in Rails and use them to enumerate ActiveRecord attributes"
14
10
 
15
11
  spec = Gem::Specification.new do |s|
16
12
  s.name = GEM_NAME
@@ -19,12 +15,12 @@ spec = Gem::Specification.new do |s|
19
15
  s.rubyforge_project = "active_enum"
20
16
  s.has_rdoc = true
21
17
  s.extra_rdoc_files = ["README.rdoc"]
22
- s.summary = SUMMARY
18
+ s.summary = "Define enum classes in Rails and use them to enumerate ActiveRecord attributes"
23
19
  s.description = s.summary
24
- s.author = AUTHOR
25
- s.email = EMAIL
26
- s.homepage = HOMEPAGE
27
-
20
+ s.author = "Adam Meehan"
21
+ s.email = "adam.meehan@gmail.com"
22
+ s.homepage = "http://github.com/adzap/active_enum"
23
+
28
24
  s.require_path = 'lib'
29
25
  s.autorequire = GEM_NAME
30
26
  s.files = %w(MIT-LICENSE README.rdoc Rakefile) + Dir.glob("{lib,spec}/**/*")
@@ -26,6 +26,8 @@ module ActiveEnum
26
26
  # enumerate :to, :from, :with => Sex
27
27
  #
28
28
  def enumerate(*attributes, &block)
29
+ define_attribute_methods unless generated_methods?
30
+
29
31
  options = attributes.extract_options!
30
32
  attributes.each do |attribute|
31
33
  begin
@@ -62,10 +64,6 @@ module ActiveEnum
62
64
  # user.sex(:enum)
63
65
  #
64
66
  def define_active_enum_read_method(attribute)
65
- unless instance_method_already_implemented?(attribute)
66
- define_read_method(attribute, attribute.to_s, columns_hash[attribute.to_s])
67
- end
68
-
69
67
  old_method = "#{attribute}_without_enum"
70
68
  define_method("#{attribute}_with_enum") do |*arg|
71
69
  arg = arg.first
@@ -93,10 +91,6 @@ module ActiveEnum
93
91
  # user.sex = :male
94
92
  #
95
93
  def define_active_enum_write_method(attribute)
96
- unless instance_method_already_implemented?("#{attribute}=")
97
- define_write_method(attribute)
98
- end
99
-
100
94
  old_method = "#{attribute}_without_enum="
101
95
  define_method("#{attribute}_with_enum=") do |arg|
102
96
  enum = self.class.enum_for(attribute)
@@ -116,8 +110,6 @@ module ActiveEnum
116
110
  # user.sex?(:male)
117
111
  #
118
112
  def define_active_enum_question_method(attribute)
119
- define_question_method(attribute) unless instance_method_already_implemented?("#{attribute}?")
120
-
121
113
  old_method = "#{attribute}_without_enum?"
122
114
  define_method("#{attribute}_with_enum?") do |*arg|
123
115
  arg = arg.first
@@ -1,3 +1,3 @@
1
1
  module ActiveEnum
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan
@@ -9,7 +9,7 @@ autorequire: active_enum
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-28 00:00:00 +11:00
12
+ date: 2010-02-04 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies: []
15
15