Class: MergetrainCheck::TraintableFormatter
- Inherits:
-
Object
- Object
- MergetrainCheck::TraintableFormatter
- Defined in:
- lib/mergetrain_check/formatter.rb
Instance Method Summary collapse
- #format(body) ⇒ Object
-
#initialize(max_length, firstname_only) ⇒ TraintableFormatter
constructor
A new instance of TraintableFormatter.
Constructor Details
#initialize(max_length, firstname_only) ⇒ TraintableFormatter
Returns a new instance of TraintableFormatter.
3 4 5 6 |
# File 'lib/mergetrain_check/formatter.rb', line 3 def initialize(max_length, firstname_only) @max_length = max_length @firstname_only = firstname_only end |
Instance Method Details
#format(body) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mergetrain_check/formatter.rb', line 8 def format(body) values = [['St', 'MR', 'Pipe ID', 'User', 'Title']] body.each do |carriage| values << [pipeline_status(carriage['status']), carriage['merge_request']['iid'], carriage['pipeline']['id'], @firstname_only ? carriage['user']['name'].split.first : carriage['user']['name'], truncate_string(carriage['merge_request']['title'], @max_length)] end values.to_table end |