Class: OpenapiBlocks::Schema::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_blocks/schema/validator.rb

Overview

rubocop:disable Style/Documentation

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Validator

Returns a new instance of Validator.



6
7
8
# File 'lib/openapi_blocks/schema/validator.rb', line 6

def initialize(model)
  @model = model
end

Instance Method Details

#extractObject



10
11
12
13
14
15
16
17
# File 'lib/openapi_blocks/schema/validator.rb', line 10

def extract
  @model.validators.each_with_object({}) do |validator, hash|
    validator.attributes.each do |attribute|
      hash[attribute.to_s] ||= {}
      hash[attribute.to_s].merge!(convert(validator))
    end
  end
end