Sha256: e068f41beeae526c798358dec3821384907667f84f45d1d27887dc82f4a4ae03
Contents?: true
Size: 672 Bytes
Versions: 1
Compression:
Stored size: 672 Bytes
Contents
module Timber module Patterns # Module to fall inline with Rail's core object crazy changes. # If Rails is present, it will play nice. If not, it will work just fine. module ToJSON # We explicitly do not do anything with the arguments as we do not need them. # We avoid the unneccssary complexity. def as_json(*_args) @as_json ||= Macros::Compactor.compact(json_payload).freeze end def to_json(*_args) @to_json ||= as_json.to_json.freeze end private def json_payload raise NotImplementedError.new("#json_payload is not implemented for #{self.class}") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timberio-1.0.0.beta1 | lib/timber/patterns/to_json.rb |