Method: DataMapper::Property::Json#load

Defined in:
lib/dm-types/json.rb

#load(value) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/dm-types/json.rb', line 10

def load(value)
  if value.nil? || value_loaded?(value)
    value
  elsif value.is_a?(::String)
    typecast(value)
  else
    raise ArgumentError.new("+value+ of a property of JSON type must be nil or a String")
  end
end