Class: RubyCritic::Generator::Html::Line

Inherits:
Base
  • Object
show all
Defined in:
lib/rubycritic/generators/html/line.rb

Constant Summary collapse

NORMAL_TEMPLATE =
erb_template('line.html.erb')
SMELLY_TEMPLATE =
erb_template('smelly_line.html.erb')

Constants inherited from Base

Base::LAYOUT_TEMPLATE, Base::TEMPLATES_DIR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

erb_template, #file_href, #file_name, #file_pathname

Methods included from ViewHelpers

#asset_path, #code_index_path, #file_path, #smell_location_path, #timeago_tag

Constructor Details

#initialize(file_directory, text, smells) ⇒ Line

Returns a new instance of Line.



15
16
17
18
19
# File 'lib/rubycritic/generators/html/line.rb', line 15

def initialize(file_directory, text, smells)
  @file_directory = file_directory
  @text = CGI.escapeHTML(text.chomp)
  @smells = smells
end

Instance Attribute Details

#file_directoryObject (readonly)

Returns the value of attribute file_directory.



13
14
15
# File 'lib/rubycritic/generators/html/line.rb', line 13

def file_directory
  @file_directory
end

Instance Method Details

#renderObject



21
22
23
# File 'lib/rubycritic/generators/html/line.rb', line 21

def render
  template.result(binding).delete("\n") + "\n"
end