Class: RailsApiDoc::Model::AttributeMerger

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_api_doc/model/attribute_merger.rb

Overview

author: Vadim Shaveiko <@vshaveyko> :nodoc:

Constant Summary collapse

MODEL =
RailsApiDoc::ApiDatum
MERGABLE_FIELDS =
[:type, :desc, :action_type].freeze

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ AttributeMerger

do not mutate attributes

please - impossible



14
15
16
# File 'lib/rails_api_doc/model/attribute_merger.rb', line 14

def initialize(attributes)
  @attrs = attributes
end

Instance Method Details

#call(api_type:) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/rails_api_doc/model/attribute_merger.rb', line 18

def call(api_type:)
  @api_type = api_type

  api_params = MODEL.where(api_type: api_type).all.each do |param|
    _add_nested_param(param)
  end

  @attrs
end