Class: Types::StrippedStringType

Inherits:
ActiveRecord::Type::String
  • Object
show all
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

#typeObject



4
5
6
# File 'app/lib/types/stripped_string_type.rb', line 4

def type
  :stripped_string
end