Class: ZLocalize::OperatorExpression
- Inherits:
-
Expression
- Object
- Expression
- ZLocalize::OperatorExpression
- Defined in:
- lib/zlocalize/rdoc_source_parser.rb
Overview
an Operator expression holds the operator itself, and the operands
Instance Attribute Summary collapse
-
#operands ⇒ Object
Returns the value of attribute operands.
-
#operator ⇒ Object
:nodoc: all.
Attributes inherited from Expression
#char_no, #line_no, #sub_method, #text
Instance Method Summary collapse
- #display(indent = 0) ⇒ Object
-
#initialize(line_no, char_no, op) ⇒ OperatorExpression
constructor
A new instance of OperatorExpression.
- #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, op) ⇒ OperatorExpression
Returns a new instance of OperatorExpression.
277 278 279 280 281 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 277 def initialize(line_no,char_no,op) super(line_no,char_no,op) @operands = [] @operator = op end |
Instance Attribute Details
#operands ⇒ Object
Returns the value of attribute operands.
275 276 277 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 275 def operands @operands end |
#operator ⇒ Object
:nodoc: all
274 275 276 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 274 def operator @operator end |
Instance Method Details
#display(indent = 0) ⇒ Object
283 284 285 286 287 288 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 283 def display(indent = 0) p = prefix(indent) i = p + "#{self.class.name} (#{line_no},#{char_no})\n" @operands.each { |o| i << o.display(indent+1) } i end |
#to_entry_string ⇒ Object
294 295 296 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 294 def to_entry_string @operands.collect { |o| o.to_entry_string }.join(" #{@operator} ").force_encoding("UTF-8") end |
#to_translation_entry(filename) ⇒ Object
290 291 292 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 290 def to_translation_entry(filename) @operands.collect { |o| o.to_translation_entry(filename) }.flatten.compact end |