Class: RubyCritic::Generator::Text::Lint

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/generators/text/lint.rb

Constant Summary collapse

TEMPLATE_PATH =
File.expand_path('templates/lint.erb', __dir__)
FILE_NAME =
'lint.txt'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(analysed_module) ⇒ Lint

Returns a new instance of Lint.


25
26
27
# File 'lib/rubycritic/generators/text/lint.rb', line 25

def initialize(analysed_module)
  @analysed_module = analysed_module
end

Class Method Details

.erb_templateObject


20
21
22
# File 'lib/rubycritic/generators/text/lint.rb', line 20

def erb_template
  @erb_template ||= ERB.new(File.read(TEMPLATE_PATH), nil, '-')
end

.file_directoryObject


12
13
14
# File 'lib/rubycritic/generators/text/lint.rb', line 12

def file_directory
  @file_directory ||= Pathname.new(Config.root)
end

.file_pathnameObject


16
17
18
# File 'lib/rubycritic/generators/text/lint.rb', line 16

def file_pathname
  Pathname.new(file_directory).join FILE_NAME
end

Instance Method Details

#renderObject


29
30
31
# File 'lib/rubycritic/generators/text/lint.rb', line 29

def render
  erb_template.result(binding)
end