Class: AdLint::MessageDefinitionFile
- Inherits:
-
Object
- Object
- AdLint::MessageDefinitionFile
show all
- Defined in:
- lib/adlint/message.rb
Instance Method Summary
collapse
Constructor Details
379
380
381
382
|
# File 'lib/adlint/message.rb', line 379
def initialize(pkg_name, lang_name)
@package_name = pkg_name
@language_name = lang_name
end
|
Instance Method Details
#read_into(msg_catalog) ⇒ Object
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
# File 'lib/adlint/message.rb', line 384
def read_into(msg_catalog)
File.open(fpath, "r:utf-8") do |io|
case ary_or_stream = YAML.load_stream(io)
when Array
doc = ary_or_stream.first
when YAML::Stream
doc = ary_or_stream.documents.first
end
validate_version(doc["version"])
if msg_def = doc["message_definition"]
msg_catalog.merge!(@package_name, msg_def)
else
raise "invalid form of the message definition file."
end
end
self
end
|