Sha256: ddfc319cf750ce2ff02161e6f0893902e85ecac10bc10b4801f503b396d980c3
Contents?: true
Size: 496 Bytes
Versions: 1
Compression:
Stored size: 496 Bytes
Contents
require 'alba/version' require 'json' # Core module module Alba class Error < StandardError; end def self.backend=(backend) @backend = backend&.to_sym end def self.backend @backend end def self.serialize(object) fallback = ->(resource) { resource.to_json } case backend when :oj begin require 'oj' ->(resource) { Oj.dump(resource) } rescue LoadError fallback end else fallback end.call(object) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alba-0.0.1 | lib/alba.rb |