has_constant 0.2.4 → 0.2.5

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.2.4
1
+ 0.2.5
data/has_constant.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_constant}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mattbeedle"]
@@ -21,8 +21,6 @@ module HasConstant
21
21
  def has_constant( name, values, options = {} )
22
22
  super(name, values, options)
23
23
 
24
- values = values.call if values.respond_to?(:call)
25
-
26
24
  singular = (options[:accessor] || name.to_s.singularize).to_s
27
25
 
28
26
  # Add the getter method. This returns the string representation of the stored value
@@ -35,6 +33,7 @@ module HasConstant
35
33
  if index = self.class.send(name.to_s).index(val)
36
34
  write_attribute singular.to_sym, index
37
35
  else
36
+ values = values.call if values.respond_to?(:call)
38
37
  @has_constant_errors ||= {}
39
38
  @has_constant_errors.merge!(singular.to_sym => "must be one of #{values.join(', ')}")
40
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_constant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - mattbeedle