Class: Pronto::BigFiles::MessageCreator
- Inherits:
-
Object
- Object
- Pronto::BigFiles::MessageCreator
- Defined in:
- lib/pronto/bigfiles/message_creator.rb
Overview
Creates Pronto warning message objects
Instance Attribute Summary collapse
-
#num_files ⇒ Object
readonly
Returns the value of attribute num_files.
-
#target_num_lines ⇒ Object
readonly
Returns the value of attribute target_num_lines.
-
#total_lines ⇒ Object
readonly
Returns the value of attribute total_lines.
Instance Method Summary collapse
- #create_message(patch_wrapper, num_lines) ⇒ Object
-
#initialize(num_files, total_lines, target_num_lines) ⇒ MessageCreator
constructor
A new instance of MessageCreator.
Constructor Details
#initialize(num_files, total_lines, target_num_lines) ⇒ MessageCreator
Returns a new instance of MessageCreator.
12 13 14 15 16 |
# File 'lib/pronto/bigfiles/message_creator.rb', line 12 def initialize(num_files, total_lines, target_num_lines) @num_files = num_files @total_lines = total_lines @target_num_lines = target_num_lines end |
Instance Attribute Details
#num_files ⇒ Object (readonly)
Returns the value of attribute num_files.
10 11 12 |
# File 'lib/pronto/bigfiles/message_creator.rb', line 10 def num_files @num_files end |
#target_num_lines ⇒ Object (readonly)
Returns the value of attribute target_num_lines.
10 11 12 |
# File 'lib/pronto/bigfiles/message_creator.rb', line 10 def target_num_lines @target_num_lines end |
#total_lines ⇒ Object (readonly)
Returns the value of attribute total_lines.
10 11 12 |
# File 'lib/pronto/bigfiles/message_creator.rb', line 10 def total_lines @total_lines end |
Instance Method Details
#create_message(patch_wrapper, num_lines) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pronto/bigfiles/message_creator.rb', line 18 def (patch_wrapper, num_lines) path = patch_wrapper.path line = patch_wrapper.first_added_line level = :warning msg = "This file, one of the #{num_files} largest in the project, " \ "increased in size to #{num_lines} lines. The total size " \ "of those files is now #{total_lines} lines " \ "(target: #{target_num_lines}). Is this file complex " \ "enough to refactor?" Message.new(path, line, level, msg, nil, Pronto::BigFiles) end |