Sha256: 7b3fb75be161b47b7c415757f3d550eed585acd7cf6be1da910d36c29d20d5e0

Contents?: true

Size: 765 Bytes

Versions: 3

Compression:

Stored size: 765 Bytes

Contents

require 'yaml'

require 'hound/tools/template'

module Hound
  module Tools
    class HoundDefaults
      include Template

      def initialize
        super('.hound/defaults.yml')
      end

      private

      def _validate(content)
        config = YAML.load(content)
        literals = config['StringLiterals']
        fail InvalidTemplate, 'No StringLiterals section' unless literals

        quote_style = literals['EnforcedStyle']
        fail InvalidTemplate, 'No EnforcedStyle section' unless quote_style
        fail InvalidTemplate, 'No double_quotes value'  unless quote_style == 'double_quotes'

        # TODO: not tested
        fail InvalidTemplate, "Detected 'inherited_from' section" if config.key?('inherited_from')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hound-tools-0.0.6 lib/hound/tools/hound_defaults.rb
hound-tools-0.0.5 lib/hound/tools/hound_defaults.rb
hound-tools-0.0.4 lib/hound/tools/hound_defaults.rb