Sha256: 8ad26d3d7cd2c2239832b57f0ceb349e26750e4b8a85b342e82cfc17ad35fc9f
Contents?: true
Size: 994 Bytes
Versions: 7
Compression:
Stored size: 994 Bytes
Contents
# frozen_string_literal: true # :reek:InstanceVariableAssumption # :reek:NilCheck module SwaggerDocsGenerator module Actions # Write parameter type :header class Header < Parameter FIELDS = %w[description format default enum].freeze def to_hash { in: :header, name: @name, required: @required.nil? ? true : @required, type: @type }.merge(no_mandatory_field) end private def type(text) @type = text end def default(text) @default = text end def enum(array) @enum = array end def format(text) @format = text end def no_mandatory_field hash = {} FIELDS.each do |parameter| value = instance_variable_get("@#{parameter}") hash.merge!(parameter.to_sym => value) if value.present? end hash end end end end
Version data entries
7 entries across 7 versions & 1 rubygems