Sha256: 02fc046aae80f31c7a579cc44f7929372df76f77f353537fc053f026f41dd8c1

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

#
# Make the Grape::Endpoint quack like a ActionController
#
# This allows us to rely on the ActiveModel::Serializer#build_json method
# to lookup the approriate serializer.
#
module Grape
  module EndpointExtension
    attr_accessor :controller_name

    def namespace_options
      settings[:namespace] ? settings[:namespace].options : {}
    end

    def route_options
      options[:route_options]
    end

    def default_serializer_options; end
    def serialization_scope; end
    def _serialization_scope; end
    def url_options; end
  end

  Endpoint.send(:include, EndpointExtension)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-active_model_serializers-1.0.1 lib/grape-active_model_serializers/endpoint_extension.rb
grape-active_model_serializers-1.0.0 lib/grape-active_model_serializers/endpoint_extension.rb