Class: Apipie::Generator::Swagger::ParamDescription::Description

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

Instance Method Summary collapse

Constructor Details

#initialize(param_description, language:) ⇒ Description

Returns a new instance of Description.



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

def initialize(param_description, language:)
  @param_description = param_description
  @language = language
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


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

def to_hash
  description = @param_description.options[:desc]

  return {} if description.blank?

  { description: Apipie.app.translate(description, @language) }
end