Class: Grape::ActiveModelSerializers::OptionsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/grape-active_model_serializers/options_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource, env) ⇒ OptionsBuilder

Returns a new instance of OptionsBuilder.


4
5
6
7
# File 'lib/grape-active_model_serializers/options_builder.rb', line 4

def initialize(resource, env)
  self.resource = resource
  self.env = env
end

Instance Method Details

#optionsObject


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grape-active_model_serializers/options_builder.rb', line 9

def options
  @options ||= (
    options = endpoint_options
    options[:scope] = endpoint unless options.key?(:scope)
    options.merge!(default_root_options) unless options.key?(:root)
    options.merge!(meta_options)
    options.merge!(adapter_options)
    options.merge!(extra_options)
    options
  )
end