Sha256: 090e9afad84a4a004aa51f1de1af5819eb84c6a6881c2d84a1cbf949a27e30e1

Contents?: true

Size: 1.64 KB

Versions: 8

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

require 'active_model'
require 'active_support'
require 'active_support/core_ext/object/with_options'
require 'active_support/core_ext/string/inflections'
require 'active_support/json'
module ActiveModelSerializers
  extend ActiveSupport::Autoload
  eager_autoload do
    autoload :Model
    autoload :Callbacks
    autoload :SerializableResource
    autoload :SerializationContext
    autoload :Logging
    autoload :Test
    autoload :Adapter
    autoload :JsonPointer
    autoload :Deprecate
    autoload :LookupChain
    autoload :Deserialization
  end

  class << self; attr_accessor :logger; end
  self.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))

  def self.config
    ActiveModel::Serializer.config
  end

  # The file name and line number of the caller of the caller of this method.
  def self.location_of_caller
    caller[1] =~ /(.*?):(\d+).*?$/i
    file = Regexp.last_match(1)
    lineno = Regexp.last_match(2).to_i

    [file, lineno]
  end

  # Memoized default include directive
  # @return [JSONAPI::IncludeDirective]
  def self.default_include_directive
    @default_include_directive ||= JSONAPI::IncludeDirective.new(config.default_includes, allow_wildcard: true)
  end

  def self.silence_warnings
    original_verbose = $VERBOSE
    $VERBOSE = nil
    yield
  ensure
    $VERBOSE = original_verbose
  end

  def self.eager_load!
    super
    ActiveModel::Serializer.eager_load!
  end

  require 'active_model/serializer/version'
  require 'active_model/serializer'
  require 'active_model/serializable_resource'
  require 'active_model_serializers/railtie' if defined?(::Rails::Railtie)
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
active_model_serializers-0.10.15 lib/active_model_serializers.rb
active_model_serializers-0.10.14 lib/active_model_serializers.rb
active_model_serializers-0.10.13 lib/active_model_serializers.rb
active_model_serializers-0.10.12 lib/active_model_serializers.rb
active_model_serializers-0.10.11 lib/active_model_serializers.rb
active_model_serializers-0.10.10 lib/active_model_serializers.rb
active_model_serializers_custom-0.10.90 lib/active_model_serializers.rb
active_model_serializers-0.10.9 lib/active_model_serializers.rb