Class: Types::StrippedStringType
- Inherits:
-
ActiveRecord::Type::String
- Object
- ActiveRecord::Type::String
- Types::StrippedStringType
- Defined in:
- app/lib/types/stripped_string_type.rb
Overview
Library code: stripped string type.
Instance Method Summary collapse
Instance Method Details
#cast(value) ⇒ Object
8 9 10 11 12 |
# File 'app/lib/types/stripped_string_type.rb', line 8 def cast(value) return nil if value.nil? super.then { |s| s&.squish.presence } end |
#type ⇒ Object
4 5 6 |
# File 'app/lib/types/stripped_string_type.rb', line 4 def type :stripped_string end |