Class: Starter::Importer::Description
- Inherits:
-
Object
- Object
- Starter::Importer::Description
- Defined in:
- lib/starter/importer/description.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
- #block_keys ⇒ Object
-
#initialize(content:) ⇒ Description
constructor
A new instance of Description.
-
#to_s ⇒ Object
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(content:) ⇒ Description
Returns a new instance of Description.
8 9 10 |
# File 'lib/starter/importer/description.rb', line 8 def initialize(content:) @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/starter/importer/description.rb', line 6 def content @content end |
Instance Method Details
#block_keys ⇒ Object
28 29 30 31 32 33 |
# File 'lib/starter/importer/description.rb', line 28 def block_keys %w[ description tags ] end |
#to_s ⇒ Object
rubocop:disable Metrics/AbcSize
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/starter/importer/description.rb', line 12 def to_s # rubocop:disable Metrics/AbcSize return if content.blank? desc = content['summary'] || content['operationId'] entry = "desc '#{desc}'\n" return entry unless block_keys.intersect?(content.keys) entry.sub!("\n", " do\n") entry << " detail '#{content['description']}'\n" if content.key?('description') entry << " tags #{content['tags']}\n" if content.key?('tags') entry << 'end' entry end |