module AdequateSerialization
Constants
- VERSION
Attributes
active_job_queue[R]
Public Class Methods
active_job_queue=(queue_name)
click to toggle source
Configure the queue name that AdequateSerialization
will use when enqueuing jobs to bust associated caches.
# File lib/adequate_serialization.rb, line 17 def active_job_queue=(queue_name) require 'adequate_serialization/rails/cache_refresh' CacheRefresh::CacheRefreshJob.queue_name = queue_name end
associate_cache(active_record, *association_names)
click to toggle source
Associate one or more caches with an active record such that when the record is updated the associated object caches are also updated.
# File lib/adequate_serialization.rb, line 24 def associate_cache(active_record, *association_names) require 'adequate_serialization/rails/cache_refresh' unless active_record.respond_to?(:associate_cache) active_record.extend(CacheRefresh) end association_names.each do |association_name| active_record.associate_cache(association_name) end end
configure() { |self| ... }
click to toggle source
DSL-like block for parity with other Ruby/Rails libraries.
# File lib/adequate_serialization.rb, line 37 def configure yield self end
dump(object)
click to toggle source
# File lib/adequate_serialization/attribute.rb, line 4 def self.dump(object) if object.is_a?(Hash) object elsif object.respond_to?(:as_json) object.as_json else object end end
inline(&block)
click to toggle source
# File lib/adequate_serialization/inline_serializer.rb, line 54 def self.inline(&block) InlineSerializer.new(&block) end
prepend(step)
click to toggle source
# File lib/adequate_serialization/steps.rb, line 29 def prepend(step) @steps = step.new(steps) end
steps()
click to toggle source
# File lib/adequate_serialization/steps.rb, line 33 def steps @steps ||= Steps::SerializeStep.new end