Class: AdLint::MessageTemplate
- Inherits:
-
Object
- Object
- AdLint::MessageTemplate
- Defined in:
- lib/adlint/message.rb
Overview
DESCRIPTION
Message catalog entry.
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#typical_class ⇒ Object
readonly
Returns the value of attribute typical_class.
Instance Method Summary collapse
- #categories ⇒ Object
- #format(parts) ⇒ Object
-
#initialize(msg_id, classes, fmt) ⇒ MessageTemplate
constructor
A new instance of MessageTemplate.
- #severities ⇒ Object
Constructor Details
#initialize(msg_id, classes, fmt) ⇒ MessageTemplate
Returns a new instance of MessageTemplate.
350 351 352 353 354 355 |
# File 'lib/adlint/message.rb', line 350 def initialize(msg_id, classes, fmt) @message_id = msg_id @classes = classes.map { |class_str| MessageClass.new(class_str) } @format = fmt @typical_class = @classes.sort { |msg_class| msg_class.severity }.first end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
358 359 360 |
# File 'lib/adlint/message.rb', line 358 def classes @classes end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
357 358 359 |
# File 'lib/adlint/message.rb', line 357 def @message_id end |
#typical_class ⇒ Object (readonly)
Returns the value of attribute typical_class.
359 360 361 |
# File 'lib/adlint/message.rb', line 359 def typical_class @typical_class end |
Instance Method Details
#categories ⇒ Object
361 362 363 |
# File 'lib/adlint/message.rb', line 361 def categories @classes.map { |c| c.category } end |
#format(parts) ⇒ Object
369 370 371 372 |
# File 'lib/adlint/message.rb', line 369 def format(parts) @format.to_s.to_default_external % parts.map { |obj| obj.to_s.to_default_external } end |
#severities ⇒ Object
365 366 367 |
# File 'lib/adlint/message.rb', line 365 def severities @classes.map { |c| c.severity } end |