lib/adequate_serialization.rb in adequate_serialization-0.1.1 vs lib/adequate_serialization.rb in adequate_serialization-1.0.0

- old
+ new

@@ -1,34 +1,19 @@ # frozen_string_literal: true require 'adequate_serialization/attribute' require 'adequate_serialization/decorator' +require 'adequate_serialization/inline_serializer' require 'adequate_serialization/options' require 'adequate_serialization/serializable' require 'adequate_serialization/serializer' require 'adequate_serialization/steps' require 'adequate_serialization/version' -require 'adequate_serialization/steps/passthrough_step' +require 'adequate_serialization/steps/step' require 'adequate_serialization/steps/serialize_step' -module AdequateSerialization - class << self - def dump(object) - if object.is_a?(Hash) - object - elsif object.respond_to?(:as_json) - object.as_json - else - object - end - end - - def hook_into_rails! - @hook_into_rails ||= - begin - require 'adequate_serialization/rails/hook' - Rails.hook_in! - end - end - end +if defined?(::Rails) + require 'adequate_serialization/rails/cache_step' + require 'adequate_serialization/rails/relation_serializer' + ActiveRecord::Base.include(AdequateSerialization::Serializable) end