Class: YARD::I18n::Messages
- Inherits:
-
Object
- Object
- YARD::I18n::Messages
- Includes:
- Enumerable
- Defined in:
- lib/yard/i18n/messages.rb
Overview
Acts as a container for Message objects.
Instance Attribute Summary (collapse)
-
- (Hash{String=>Message}) messages
readonly
protected
The set of message objects.
Instance Method Summary (collapse)
-
- (Boolean) ==(other)
Checks if this messages list is equal to another messages list.
-
- (Message?) [](id)
A registered message for the given id, or nil if no message for the ID is found.
-
- (void) each {|message| ... }
Enumerates each Message in the container.
-
- (Messages) initialize
constructor
Creates a new container.
-
- (Message) register(id)
Registers a Message, the mssage ID of which is id.
Constructor Details
- (Messages) initialize
Creates a new container.
10 11 12 |
# File 'lib/yard/i18n/messages.rb', line 10 def initialize @messages = {} end |
Instance Attribute Details
Instance Method Details
- (Boolean) ==(other)
Checks if this messages list is equal to another messages list.
44 45 46 47 |
# File 'lib/yard/i18n/messages.rb', line 44 def ==(other) other.is_a?(self.class) and @messages == other. end |
- (Message?) [](id)
Returns a registered message for the given id, or nil if no message for the ID is found.
26 27 28 |
# File 'lib/yard/i18n/messages.rb', line 26 def [](id) @messages[id] end |
- (void) each {|message| ... }
This method returns an undefined value.
Enumerates each YARD::I18n::Message in the container.
19 20 21 |
# File 'lib/yard/i18n/messages.rb', line 19 def each(&block) @messages.each_value(&block) end |
- (Message) register(id)
Registers a YARD::I18n::Message, the mssage ID of which is id. If corresponding Message is already registered, the previously registered object is returned.
36 37 38 |
# File 'lib/yard/i18n/messages.rb', line 36 def register(id) @messages[id] ||= Message.new(id) end |