Module: Jat::Plugins::Cache::InstanceMethods

Defined in:
lib/jat/plugins/cache/cache.rb

Constant Summary collapse

FORMAT_TO_STR =
:to_str
FORMAT_TO_H =
:to_h

Instance Method Summary collapse

Instance Method Details

#to_h(object) ⇒ Object



22
23
24
25
26
27
# File 'lib/jat/plugins/cache/cache.rb', line 22

def to_h(object)
  return super if context[:_format] == FORMAT_TO_STR

  context[:_format] = FORMAT_TO_H
  cached(object) { super }
end

#to_str(object) ⇒ Object



29
30
31
32
# File 'lib/jat/plugins/cache/cache.rb', line 29

def to_str(object)
  context[:_format] = FORMAT_TO_STR
  cached(object) { super }
end