Class: Documentation

Inherits:
Object
  • Object
show all
Defined in:
lib/ducalis/documentation.rb

Constant Summary collapse

SIGNAL_WORD =
'raises'.freeze
PREFER_WORD =
'better'.freeze
RULE_WORD =
'[rule]'.freeze

Instance Method Summary collapse

Instance Method Details

#callObject



81
82
83
84
85
# File 'lib/ducalis/documentation.rb', line 81

def call
  cops.map do |file|
    present_cop(klass_const_for(file), spec_cases_for(file))
  end.flatten.join("\n")
end

#cop_rulesObject



72
73
74
75
76
77
78
79
# File 'lib/ducalis/documentation.rb', line 72

def cop_rules
  cops.map do |file|
    rules = spec_cases_for(file).select do |desc, _code|
      desc.include?(RULE_WORD)
    end
    [file, rules]
  end
end