Class: Rubycritic::Generator::Line
- Defined in:
- lib/rubycritic/report_generators/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
-
#file_directory ⇒ Object
readonly
Returns the value of attribute file_directory.
Instance Method Summary collapse
-
#initialize(file_directory, text, smells) ⇒ Line
constructor
A new instance of Line.
- #render ⇒ Object
Methods inherited from Base
erb_template, #file_href, #file_name, #file_pathname
Methods included from ViewHelpers
#asset_path, #file_path, #javascript_tag, #smell_location_path, #stylesheet_path, #timeago_tag
Constructor Details
#initialize(file_directory, text, smells) ⇒ Line
Returns a new instance of Line.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubycritic/report_generators/line.rb', line 13 def initialize(file_directory, text, smells) @file_directory = file_directory @text = CGI::escapeHTML(text.chomp) @smells = smells @template = if @smells.empty? NORMAL_TEMPLATE else SMELLY_TEMPLATE end end |
Instance Attribute Details
#file_directory ⇒ Object (readonly)
Returns the value of attribute file_directory.
11 12 13 |
# File 'lib/rubycritic/report_generators/line.rb', line 11 def file_directory @file_directory end |
Instance Method Details
#render ⇒ Object
25 26 27 |
# File 'lib/rubycritic/report_generators/line.rb', line 25 def render @template.result(binding).delete("\n") + "\n" end |