Class: GlueGun::Types::ArrayType

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

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/glue_gun/types/array_type.rb', line 4

def cast(value)
  case value
  when String
    parse_string(value)
  when Array
    value
  else
    []
  end
end

#serialize(value) ⇒ Object



15
16
17
# File 'lib/glue_gun/types/array_type.rb', line 15

def serialize(value)
  value.to_json
end