Class: AttrTypecastable::Types::Symbol
- Defined in:
- lib/attr_typecastable/types/symbol.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from AttrTypecastable::Types::Base
Instance Method Details
#do_typecast(value) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/attr_typecastable/types/symbol.rb', line 7 def do_typecast(value) return value if value.is_a?(::Symbol) if value.respond_to?(:to_sym) value.to_sym else raise CastError, "value does not have `to_sym` method" end end |