Sha256: 88d8f3664405164c086552de7b5471e292742499b33081223eac2aaad01d66a2

Contents?: true

Size: 903 Bytes

Versions: 12

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

module R2OAS
  class Base
    def initialize(options = {})
      @options = options

      (AppConfiguration::VALID_OPTIONS_KEYS + options.keys).each do |key|
        send("#{key}=", merged_options[key])
      end
    end

    private

    attr_accessor *AppConfiguration::VALID_OPTIONS_KEYS

    def merged_options
      if @options.present?
        R2OAS.options.merge(@options)
      else
        R2OAS.options
      end
    end

    def logger
      R2OAS.logger
    end

    def schema_save_dir_path
      File.expand_path("#{root_dir_path}/#{schema_save_dir_name}")
    end

    def doc_save_file_path
      File.expand_path("#{root_dir_path}/#{doc_save_file_name}")
    end

    def ns_div
      case namespace_type
      when :dot
        '.'
      when :underbar
        '_'
      else
        raise "Do not support #{namespace_type}"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
r2-oas-0.5.0 lib/r2-oas/base.rb
r2-oas-0.4.1 lib/r2-oas/base.rb
r2-oas-0.4.0 lib/r2-oas/base.rb
r2-oas-0.3.4 lib/r2-oas/base.rb
r2-oas-0.3.3 lib/r2-oas/base.rb
r2-oas-0.3.2 lib/r2-oas/base.rb
r2-oas-0.3.1 lib/r2-oas/base.rb
r2-oas-0.3.0 lib/r2-oas/base.rb
r2-oas-0.2.0 lib/r2-oas/base.rb
r2-oas-0.1.3 lib/r2-oas/base.rb
r2-oas-0.1.2 lib/r2-oas/base.rb
r2-oas-0.1.0 lib/r2-oas/base.rb