Class: Tito::Types::StringArray

Inherits:
ActiveModel::Type::Value
  • Object
show all
Defined in:
lib/tito/types/string_array.rb

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/tito/types/string_array.rb', line 6

def cast(value)
  case value
  when Array then value.map(&:to_s)
  when nil then nil
  else [value.to_s]
  end
end

#typeObject



4
# File 'lib/tito/types/string_array.rb', line 4

def type = :string_array