Class: Vinter::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/vinter/linter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, description, &block) ⇒ Rule

Returns a new instance of Rule.



143
144
145
146
147
# File 'lib/vinter/linter.rb', line 143

def initialize(id, description, &block)
  @id = id
  @description = description
  @check = block
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



141
142
143
# File 'lib/vinter/linter.rb', line 141

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



141
142
143
# File 'lib/vinter/linter.rb', line 141

def id
  @id
end

Instance Method Details

#apply(ast) ⇒ Object



149
150
151
# File 'lib/vinter/linter.rb', line 149

def apply(ast)
  @check.call(ast)
end