module Lp::Serializable::Strategies
Private Instance Methods
collection?(boolean)
click to toggle source
# File lib/lp/serializable/strategies.rb, line 30 def collection?(boolean) { is_collection: boolean } end
flatten_and_nest_data(hash, nested)
click to toggle source
# File lib/lp/serializable/strategies.rb, line 22 def flatten_and_nest_data(hash, nested) nest_data?(flatten_hash(expose_data(hash)), nested) end
flatten_array_and_nest_data(hash, nested)
click to toggle source
# File lib/lp/serializable/strategies.rb, line 26 def flatten_array_and_nest_data(hash, nested) nest_data?(flatten_array_of_hashes(expose_data(hash)), nested) end
serializable_hash_with_class_name(resource, class_name, options = {})
click to toggle source
# File lib/lp/serializable/strategies.rb, line 17 def serializable_hash_with_class_name(resource, class_name, options = {}) "#{class_name}Serializer". constantize.new(resource, options).serializable_hash end
serialize_hash(resource, options = {})
click to toggle source
# File lib/lp/serializable/strategies.rb, line 12 def serialize_hash(resource, options = {}) "#{resource.class.name}Serializer". constantize.new(resource, options).serializable_hash end
set_nested_option(options)
click to toggle source
# File lib/lp/serializable/strategies.rb, line 34 def set_nested_option(options) options.fetch(:nested, false) end