Sha256: 8efea69a396dc60d1b49565691ca09531b6a3cda3586641d930d65e18320c5ce

Contents?: true

Size: 486 Bytes

Versions: 2

Compression:

Stored size: 486 Bytes

Contents

module Lurker
  class SchemaModifier
    class Array
      def initialize(json_schema_hash)
        @array = json_schema_hash
      end

      def merge!(data)
        build_array

        data.each do |value|
          Lurker::SchemaModifier.merge!(@array["items"], value)
        end
      end

      def append!(data)
        @array << data
      end

      private

      def build_array
        @array["type"] ||= "array"
        @array["items"] ||= {}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lurker-0.6.2 lib/lurker/schema_modifier/array.rb
lurker-0.6.1 lib/lurker/schema_modifier/array.rb