Module: Grape::EndpointExtension

Defined in:
lib/grape-active_model_serializers/endpoint_extension.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controller_nameObject

Returns the value of attribute controller_name.



9
10
11
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 9

def controller_name
  @controller_name
end

Class Method Details

.included(base) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 19

def self.included(base)
  mattr_accessor :_serialization_scope
  self._serialization_scope = :current_user

  base.class_eval do
    def serialization_scope
      send(_serialization_scope) if _serialization_scope && respond_to?(_serialization_scope, true)
    end
  end
end

Instance Method Details

#default_serializer_optionsObject



35
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 35

def default_serializer_options; end

#namespace_optionsObject



11
12
13
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 11

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

#render(resources, meta = {}) ⇒ Object



30
31
32
33
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 30

def render(resources, meta={})
  set_meta_and_meta_key(meta)
  resources
end

#route_optionsObject



15
16
17
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 15

def route_options
  options[:route_options]
end

#url_optionsObject



37
# File 'lib/grape-active_model_serializers/endpoint_extension.rb', line 37

def url_options; end