class R2OAS::Schema::V3::BaseSqueezer

Attributes

many_paths_file_paths[RW]

Public Class Methods

new(schema_data, options = {}) click to toggle source
Calls superclass method R2OAS::Base::new
# File lib/r2-oas/schema/v3/squeezer/base_squeezer.rb, line 7
def initialize(schema_data, options = {})
  super(options)
  @schema_data = schema_data
  @tag_names = create_tag_names
end

Public Instance Methods

squeeze_docs() click to toggle source
# File lib/r2-oas/schema/v3/squeezer/base_squeezer.rb, line 13
def squeeze_docs
  raise NoImplementError, 'Please implement in inherited class.'
end

Private Instance Methods

create_tag_names() click to toggle source
# File lib/r2-oas/schema/v3/squeezer/base_squeezer.rb, line 21
def create_tag_names
  many_paths_file_paths.each_with_object([]) do |unit_paths_path, result|
    paths_from_local = YAML.load_file(unit_paths_path)

    tag_name_from_path = if paths_from_local['paths'].values[0].values[0].is_a?(Array)
                           'unknown'
                         else
                           paths_from_local['paths'].values[0].values[0]['tags'][0]
                         end

    result.push(tag_name_from_path)
  end
end