Class: ZLocalize::ArrayExpression

Inherits:
IdentifierExpression show all
Defined in:
lib/zlocalize/rdoc_source_parser.rb

Overview

an Array declaration. It will hold its elements as a list of Expressions

Instance Attribute Summary collapse

Attributes inherited from IdentifierExpression

#name, #parameters

Attributes inherited from Expression

#char_no, #line_no, #sub_method, #text

Instance Method Summary collapse

Methods inherited from Expression

#is_translate_call, #prefix, #set_text

Constructor Details

#initialize(line_no, char_no) ⇒ ArrayExpression

Returns a new instance of ArrayExpression.



196
197
198
199
# File 'lib/zlocalize/rdoc_source_parser.rb', line 196

def initialize(line_no,char_no)
  super(line_no,char_no,'array')
  @elements = []
end

Instance Attribute Details

#elementsObject

:nodoc: all



194
195
196
# File 'lib/zlocalize/rdoc_source_parser.rb', line 194

def elements
  @elements
end

Instance Method Details

#display(indent = 0) ⇒ Object



201
202
203
204
205
# File 'lib/zlocalize/rdoc_source_parser.rb', line 201

def display(indent = 0)
  i = super(indent)
  @elements.each { |e| i << e.display(indent+1) }
  i
end

#to_entry_stringObject



211
212
213
214
# File 'lib/zlocalize/rdoc_source_parser.rb', line 211

def to_entry_string
  @elements.collect { |e| e.to_entry_string }
  # '[' + @elements.collect { |e| e.to_entry_string }.join(', ') + ']'
end

#to_translation_entry(filename) ⇒ Object



207
208
209
# File 'lib/zlocalize/rdoc_source_parser.rb', line 207

def to_translation_entry(filename)
  @elements.collect { |elem| elem.to_translation_entry(filename) }.flatten.compact
end