Class: ZLocalize::HashElementExpression
- Inherits:
-
IdentifierExpression
- Object
- Expression
- IdentifierExpression
- ZLocalize::HashElementExpression
- Defined in:
- lib/zlocalize/rdoc_source_parser.rb
Overview
a Hash Element. It holds the key and the value of the element as Expressions
Instance Attribute Summary collapse
-
#key ⇒ Object
:nodoc: all.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from IdentifierExpression
Attributes inherited from Expression
#char_no, #line_no, #sub_method, #text
Instance Method Summary collapse
- #display(indent = 0) ⇒ Object
-
#initialize(line_no, char_no) ⇒ HashElementExpression
constructor
A new instance of HashElementExpression.
- #to_entry_string ⇒ Object
- #to_translation_entry(filename) ⇒ Object
Methods inherited from Expression
#is_translate_call, #prefix, #set_text
Constructor Details
#initialize(line_no, char_no) ⇒ HashElementExpression
Returns a new instance of HashElementExpression.
251 252 253 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 251 def initialize(line_no,char_no) super(line_no,char_no,'hashElement') end |
Instance Attribute Details
#key ⇒ Object
:nodoc: all
248 249 250 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 248 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
249 250 251 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 249 def value @value end |
Instance Method Details
#display(indent = 0) ⇒ Object
255 256 257 258 259 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 255 def display(indent = 0) i = super(indent) i << prefix(indent) + "key:\n" + @key.display(indent+1) i << prefix(indent) + "value:\n" + @value.display(indent+1) end |
#to_entry_string ⇒ Object
265 266 267 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 265 def to_entry_string "#{key.to_entry_string} => #{value.to_entry_string}".force_encoding("UTF-8") end |
#to_translation_entry(filename) ⇒ Object
261 262 263 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 261 def to_translation_entry(filename) r = [key.to_translation_entry(filename),value.to_translation_entry(filename)].flatten.compact end |