Class: Apipie::Generator::Swagger::ParamDescription::Name

Inherits:
Object
  • Object
show all
Defined in:
lib/apipie/generator/swagger/param_description/name.rb

Instance Method Summary collapse

Constructor Details

#initialize(param_description, prefixed_by: nil) ⇒ Name

Returns a new instance of Name.



2
3
4
5
# File 'lib/apipie/generator/swagger/param_description/name.rb', line 2

def initialize(param_description, prefixed_by: nil)
  @param_description = param_description
  @prefixed_by = prefixed_by
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


8
9
10
11
12
13
14
15
16
17
# File 'lib/apipie/generator/swagger/param_description/name.rb', line 8

def to_hash
  name =
    if @prefixed_by.present?
      "#{@prefixed_by}[#{@param_description.name}]"
    else
      @param_description.name
    end

  { name: name }
end