Sha256: 71ca99f97dfed0029df1fde0977e9b778a308c8b5412bfb2c42e0ca116d05c02

Contents?: true

Size: 1.7 KB

Versions: 9

Compression:

Stored size: 1.7 KB

Contents

require 'tomograph'

module Fitting
  class Configuration
    class Yaml
      attr_reader   :title
      attr_accessor :apib_path,
                    :drafter_yaml_path,
                    :tomogram_json_path,
                    :strict,
                    :prefix,
                    :white_list,
                    :resource_white_list,
                    :ignore_list,
                    :include_resources,
                    :include_actions

      def initialize(yaml, title = 'fitting')
        @apib_path = yaml['apib_path']
        @drafter_yaml_path = yaml['drafter_yaml_path']
        @tomogram_json_path = yaml['tomogram_json_path']
        @strict = yaml['strict']
        @prefix = yaml['prefix']
        @white_list = yaml['white_list']
        @resource_white_list = yaml['resource_white_list']
        @ignore_list = yaml['ignore_list']
        @include_resources = yaml['include_resources']
        @include_actions = yaml['include_actions']
        @title = title
        default
      end

      def tomogram
        @tomogram ||= Tomograph::Tomogram.new(
          prefix: @prefix,
          apib_path: @apib_path,
          drafter_yaml_path: @drafter_yaml_path,
          tomogram_json_path: @tomogram_json_path
        )
      end

      def stats_path
        if @title == 'fitting'
          'fitting/stats'
        else
          "fitting/#{@title}/stats"
        end
      end

      def not_covered_path
        if @title == 'fitting'
          'fitting/not_covered'
        else
          "fitting/#{@title}/not_covered"
        end
      end

      private

      def default
        @strict ||= false if @strict.nil?
        @prefix ||= ''
        @ignore_list ||= []
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fitting-2.9.1 lib/fitting/configuration/yaml.rb
fitting-2.9.0 lib/fitting/configuration/yaml.rb
fitting-2.8.1 lib/fitting/configuration/yaml.rb
fitting-2.8.0 lib/fitting/configuration/yaml.rb
fitting-2.7.2 lib/fitting/configuration/yaml.rb
fitting-2.7.1 lib/fitting/configuration/yaml.rb
fitting-2.7.0 lib/fitting/configuration/yaml.rb
fitting-2.6.0 lib/fitting/configuration/yaml.rb
fitting-2.5.0 lib/fitting/configuration/yaml.rb