Class: MarkdownLint::Rule

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, description, block) ⇒ Rule

Returns a new instance of Rule.


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

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

Instance Attribute Details

#descriptionObject

Returns the value of attribute description


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

def description
  @description
end

#idObject

Returns the value of attribute id


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

def id
  @id
end

Instance Method Details

#aliases(*a) ⇒ Object


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

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

#check(&block) ⇒ Object


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

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

#params(p = nil) ⇒ Object


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

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

#tags(*t) ⇒ Object


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

def tags(*t)
  @tags = t.flatten.map {|i| i.to_sym} unless t.empty?
  @tags
end