Class: Types::StrippedStringType

Inherits:
ActiveRecord::Type::String
  • Object
show all
Defined in:
app/lib/types/stripped_string_type.rb

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object



6
7
8
9
10
# File 'app/lib/types/stripped_string_type.rb', line 6

def cast(value)
  return nil if value.nil?

  super(value).then { |s| s&.squish.presence }
end

#typeObject



2
3
4
# File 'app/lib/types/stripped_string_type.rb', line 2

def type
  :stripped_string
end