Sha256: 399efc56fa93216f3e9bd32ac180e6812684daee3aec33046e2cba69fd0a86e6

Contents?: true

Size: 607 Bytes

Versions: 2

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

module WeakSwaggerParameters
  module Definitions
    class Property
      include WeakSwaggerParameters::Definitions::LeafDefinition

      def initialize(type, name, description, options = {})
        @options = options.merge(name: name, type: type, description: description)
      end

      def apply_docs(parent_node)
        name = @options[:name]
        property_options = WeakSwaggerParameters::Services::SwaggerOptionsAdapter.adapt(@options.except(:name, :required))

        parent_node.instance_eval { property name, property_options }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weak_swagger_parameters-0.6.0 lib/weak_swagger_parameters/definitions/property.rb
weak_swagger_parameters-0.5.0 lib/weak_swagger_parameters/definitions/property.rb