Class: MarkdownLint::Rule

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

Overview

defines a single rule

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, description, block) ⇒ Rule

Returns a new instance of Rule.


6
7
8
9
10
11
12
13
# File 'lib/mdl/ruleset.rb', line 6

def initialize(id, description, block)
  @id = id
  @description = description
  @aliases = []
  @tags = []
  @params = {}
  instance_eval(&block)
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description


4
5
6
# File 'lib/mdl/ruleset.rb', line 4

def description
  @description
end

#idObject

Returns the value of attribute id


4
5
6
# File 'lib/mdl/ruleset.rb', line 4

def id
  @id
end

Instance Method Details

#aliases(*aliases) ⇒ Object


25
26
27
28
# File 'lib/mdl/ruleset.rb', line 25

def aliases(*aliases)
  @aliases.concat(aliases)
  @aliases
end

#check(&block) ⇒ Object


15
16
17
18
# File 'lib/mdl/ruleset.rb', line 15

def check(&block)
  @check = block unless block.nil?
  @check
end

#params(params = nil) ⇒ Object


30
31
32
33
# File 'lib/mdl/ruleset.rb', line 30

def params(params = nil)
  @params.update(params) unless params.nil?
  @params
end

#tags(*tags) ⇒ Object


20
21
22
23
# File 'lib/mdl/ruleset.rb', line 20

def tags(*tags)
  @tags = tags.flatten.map(&:to_sym) unless tags.empty?
  @tags
end