Class: Shrine::Plugins::Column::JsonSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/shrine/plugins/column.rb

Overview

JSON.dump and JSON.load shouldn’t be used with untrusted input, so we create this wrapper class which calls JSON.generate and JSON.parse instead.

Class Method Summary collapse

Class Method Details

.dump(data) ⇒ Object



90
91
92
# File 'lib/shrine/plugins/column.rb', line 90

def self.dump(data)
  JSON.generate(data)
end

.load(data) ⇒ Object



94
95
96
# File 'lib/shrine/plugins/column.rb', line 94

def self.load(data)
  JSON.parse(data)
end