Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deprecating :suffix option from classy_enum_attr

  • Loading branch information...
commit 2ad4f40cafc4df497048063c2907b51ebdfed8ba 1 parent db0e824
@beerlington beerlington authored
Showing with 7 additions and 1 deletion.
  1. +2 −0  CHANGELOG.md
  2. +5 −1 lib/classy_enum/attributes.rb
View
2  CHANGELOG.md
@@ -4,6 +4,8 @@
* Deprecating ClassyEnum::Base#name (use to_s.titleize instead). `name` is
too ambiguous and might get confused with Ruby's Class.name method.
+* Deprecating :suffix option from classy_enum_attr (this was a temporary
+ hack)
## 2.2.0
View
6 lib/classy_enum/attributes.rb
@@ -29,7 +29,11 @@ def classy_enum_attr(*args)
serialize_as_json = options[:serialize_as_json] || false
reader_method = attribute.to_s
- reader_method += "_#{options[:suffix]}" if options.has_key?(:suffix)
+
+ if options.has_key? :suffix
+ ActiveSupport::Deprecation.warn(':suffix option for classy_enum_attr is deprecated, and will be removed in ClassyEnum 3.0.', caller)
+ reader_method += "_#{options[:suffix]}"
+ end
klass = enum.to_s.camelize.constantize
Please sign in to comment.
Something went wrong with that request. Please try again.