Class: AdLint::MessageCatalog
- Inherits:
-
Object
- Object
- AdLint::MessageCatalog
- Defined in:
- lib/adlint/message.rb
Overview
DESCRIPTION
Message catalog.
Instance Method Summary collapse
-
#initialize(traits) ⇒ MessageCatalog
constructor
A new instance of MessageCatalog.
- #lookup(msg_id) ⇒ Object
- #merge!(pkg_name, msg_def) ⇒ Object
Constructor Details
#initialize(traits) ⇒ MessageCatalog
Returns a new instance of MessageCatalog.
448 449 450 451 452 |
# File 'lib/adlint/message.rb', line 448 def initialize(traits) @traits = traits @hash = Hash.new .each { |def_file| def_file.read_into(self) } end |
Instance Method Details
#lookup(msg_id) ⇒ Object
454 455 456 |
# File 'lib/adlint/message.rb', line 454 def lookup(msg_id) @hash[msg_id] or raise InvalidMessageIdError.new(msg_id) end |
#merge!(pkg_name, msg_def) ⇒ Object
458 459 460 461 462 463 464 465 466 467 |
# File 'lib/adlint/message.rb', line 458 def merge!(pkg_name, msg_def) msg_def.each do |msg_name_str, cont| msg_id = MessageId.new(pkg_name, msg_name_str.to_sym) if changed = @traits..change_list[msg_id] cont = changed end @hash[msg_id] = MessageTemplate.new(msg_id, cont["classes"], cont["format"]) end end |