class Aliyun::Log::Record::TypeCasting::JsonType

Public Instance Methods

cast(value) click to toggle source
# File lib/aliyun/log/record/type_casting.rb, line 182
def cast(value)
  return value unless value.is_a?(String)

  begin
    ActiveSupport::JSON.decode(value)
  rescue StandardError
    nil
  end
end
dump(value) click to toggle source
# File lib/aliyun/log/record/type_casting.rb, line 192
def dump(value)
  ActiveSupport::JSON.encode(value) unless value.nil?
end