Class: YARD::I18n::Message
- Inherits:
-
Object
- Object
- YARD::I18n::Message
- Defined in:
- lib/yard/i18n/message.rb
Overview
Message
is a translation target message. It has message ID as #id and some properties #locations and #comments.
Instance Attribute Summary collapse
-
#comments ⇒ Set
readonly
The set of comments for the messages.
-
#id ⇒ String
readonly
The message ID of the trnslation target message.
-
#locations ⇒ Set
readonly
path and line number where the message is appered.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Checks whether this message is equal to another.
-
#add_comment(comment) ⇒ void
Adds a comment for the message.
-
#add_location(path, line) ⇒ void
Adds location information for the message.
-
#initialize(id) ⇒ Message
constructor
Creates a trasnlate target message for message ID
id
.
Constructor Details
#initialize(id) ⇒ Message
Creates a trasnlate target message for message ID id
.
23 24 25 26 27 |
# File 'lib/yard/i18n/message.rb', line 23 def initialize(id) @id = id @locations = Set.new @comments = Set.new end |
Instance Attribute Details
#comments ⇒ Set (readonly)
Returns the set of comments for the messages.
18 19 20 |
# File 'lib/yard/i18n/message.rb', line 18 def comments @comments end |
#id ⇒ String (readonly)
Returns the message ID of the trnslation target message.
11 12 13 |
# File 'lib/yard/i18n/message.rb', line 11 def id @id end |
#locations ⇒ Set (readonly)
path and line number where the message is appered.
15 16 17 |
# File 'lib/yard/i18n/message.rb', line 15 def locations @locations end |
Instance Method Details
#==(other) ⇒ Boolean
Returns checks whether this message is equal to another.
48 49 50 51 52 53 |
# File 'lib/yard/i18n/message.rb', line 48 def ==(other) other.is_a?(self.class) and @id == other.id and @locations == other.locations and @comments == other.comments end |
#add_comment(comment) ⇒ void
This method returns an undefined value.
Adds a comment for the message.
42 43 44 |
# File 'lib/yard/i18n/message.rb', line 42 def add_comment(comment) @comments << comment unless comment.nil? end |
#add_location(path, line) ⇒ void
This method returns an undefined value.
Adds location information for the message.
34 35 36 |
# File 'lib/yard/i18n/message.rb', line 34 def add_location(path, line) @locations << [path, line] end |