Class: RulesConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll_frontmatter_tests/jekyll_frontmatter_tests_rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRulesConfig

Returns a new instance of RulesConfig.



42
43
44
45
46
47
48
49
# File 'lib/jekyll_frontmatter_tests/jekyll_frontmatter_tests_rules.rb', line 42

def initialize
  rules_yml = File.join(Dir.pwd, 'tests', 'schema', 'rules.yml')
  gem_path = $LOAD_PATH.select { |p| p.include? 'jekyll_frontmatter_tests' }
  default_rules_yml = File.join(gem_path, 'rules.yml')
  rules_config = File.exists?(rules_yml) ? rules_yml : default_rules_yml
  @rules = YAML.load_file(rules_config)
  @empty_rule = { "exceptions"=>[] }
end

Instance Attribute Details

#empty_ruleObject (readonly)

Returns the value of attribute empty_rule.



51
52
53
# File 'lib/jekyll_frontmatter_tests/jekyll_frontmatter_tests_rules.rb', line 51

def empty_rule
  @empty_rule
end

#rulesObject (readonly)

Returns the value of attribute rules.



51
52
53
# File 'lib/jekyll_frontmatter_tests/jekyll_frontmatter_tests_rules.rb', line 51

def rules
  @rules
end