We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c363805 + 78b648e commit e0d80f1Copy full SHA for e0d80f1
lib/enum/enum_adapter.rb
@@ -37,13 +37,15 @@ def type_cast(value)
37
end
38
39
40
- alias __type_cast_code_enum type_cast_code
41
- # Code to convert to a symbol.
42
- def type_cast_code(var_name)
43
- if type == :enum
44
- "#{self.class.name}.value_to_symbol(#{var_name})"
45
- else
46
- __type_cast_code_enum(var_name)
+ if respond_to?(:type_cast_code)
+ alias __type_cast_code_enum type_cast_code
+ # Code to convert to a symbol.
+ def type_cast_code(var_name)
+ if type == :enum
+ "#{self.class.name}.value_to_symbol(#{var_name})"
+ else
47
+ __type_cast_code_enum(var_name)
48
+ end
49
50
51
0 commit comments