Class: MarkdownLint::RuleSet

Inherits:
Object
  • Object
show all
Defined in:
lib/mdl/ruleset.rb

Overview

defines a ruleset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRuleSet

Returns a new instance of RuleSet.


40
41
42
# File 'lib/mdl/ruleset.rb', line 40

def initialize
  @rules = {}
end

Instance Attribute Details

#rulesObject (readonly)

Returns the value of attribute rules


38
39
40
# File 'lib/mdl/ruleset.rb', line 38

def rules
  @rules
end

Instance Method Details

#load(rules_file) ⇒ Object


48
49
50
51
# File 'lib/mdl/ruleset.rb', line 48

def load(rules_file)
  instance_eval(File.read(rules_file), rules_file)
  @rules
end

#load_defaultObject


53
54
55
# File 'lib/mdl/ruleset.rb', line 53

def load_default
  load(File.expand_path('rules.rb', __dir__))
end

#rule(id, description, &block) ⇒ Object


44
45
46
# File 'lib/mdl/ruleset.rb', line 44

def rule(id, description, &block)
  @rules[id] = Rule.new(id, description, block)
end