Class: ActiveModel::Type::Symbol
- Inherits:
-
String
- Object
- String
- ActiveModel::Type::Symbol
- Defined in:
- lib/activemodel_type_symbol.rb
Instance Method Summary collapse
Instance Method Details
#cast(value) ⇒ Object
7 8 9 10 11 |
# File 'lib/activemodel_type_symbol.rb', line 7 def cast(value) return nil if value.nil? raise ArgumentError, "#{value} doesn't respond to #to_sym" unless value.respond_to?(:to_sym) value.to_sym end |