Sha256: c5d7b1fcaffd39b1695fbe6d0473f90a8f5823b5d4618349a4e7abac3bbfc925

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require_relative 'base_analyzer'
require 'r2-oas/schema/v3/manager/file_manager'
require 'r2-oas/schema/v3/manager/diff/tag_diff_manager'

# Scope Rails
module R2OAS
  module Schema
    module V3
      class TagAnalyzer < BaseAnalyzer
        def initialize(after_schema_data, options = {})
          super({}, after_schema_data, options)
          @file_manager = FileManager.new('tags', :relative)
          before_schema_data = @file_manager.load_data
          @diff_manager = TagDiffManager.new(before_schema_data, after_schema_data)
        end

        def analyze_docs
          save_file_path = @file_manager.save_file_path(type: :relative)
          case @type
          when :edited
            @diff_manager.process_by_using_diff_data do |after_edited_data|
              @file_manager.save(after_edited_data.to_yaml)
              logger.info "  Write schema file: \t#{save_file_path}"
            end
          when :existing
            result = @diff_manager.after_target_data
            @file_manager.save(result.to_yaml)
            logger.info "  Write schema file: \t#{save_file_path}"
          else
            raise NoImplementError
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
r2-oas-0.5.0 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.4.1 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.4.0 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.3.4 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.3.3 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.3.2 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.3.1 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.3.0 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.2.0 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb
r2-oas-0.1.3 lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb