Class: ZLocalize::Expression
- Inherits:
-
Object
- Object
- ZLocalize::Expression
- Defined in:
- lib/zlocalize/rdoc_source_parser.rb
Overview
base class for Expressions we’re interested in
Direct Known Subclasses
ConditionalExpression, DontCareExpression, IdentifierExpression, OperatorExpression
Instance Attribute Summary collapse
-
#char_no ⇒ Object
Returns the value of attribute char_no.
-
#line_no ⇒ Object
:nodoc: all.
-
#sub_method ⇒ Object
Returns the value of attribute sub_method.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#display(indent = 0) ⇒ Object
display this Expression as a string.
-
#initialize(line_no, char_no, text = '') ⇒ Expression
constructor
A new instance of Expression.
- #is_translate_call ⇒ Object
-
#prefix(indent) ⇒ Object
puts spaces before the output generated by
display
. - #set_text(t) ⇒ Object
- #to_entry_string ⇒ Object
-
#to_translation_entry(filename) ⇒ Object
Since Expression is an abstract class, no output is generated (descendants redefine this method).
Constructor Details
#initialize(line_no, char_no, text = '') ⇒ Expression
Returns a new instance of Expression.
22 23 24 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 22 def initialize(line_no,char_no,text = '') @line_no, @char_no, @text = line_no, char_no, text end |
Instance Attribute Details
#char_no ⇒ Object
Returns the value of attribute char_no.
18 19 20 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 18 def char_no @char_no end |
#line_no ⇒ Object
:nodoc: all
17 18 19 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 17 def line_no @line_no end |
#sub_method ⇒ Object
Returns the value of attribute sub_method.
20 21 22 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 20 def sub_method @sub_method end |
#text ⇒ Object
Returns the value of attribute text.
19 20 21 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 19 def text @text end |
Instance Method Details
#display(indent = 0) ⇒ Object
display this Expression as a string. Used for debugging purposes
37 38 39 40 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 37 def display(indent = 0) i = prefix(indent) i << "#{self.class.name} (#{line_no},#{char_no}): #{@text}\n" end |
#is_translate_call ⇒ Object
52 53 54 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 52 def is_translate_call false end |
#prefix(indent) ⇒ Object
puts spaces before the output generated by display
. Used for debugging purposes.
32 33 34 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 32 def prefix(indent) ' ' * (indent*INDENT_STEP) end |
#set_text(t) ⇒ Object
26 27 28 29 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 26 def set_text(t) @text = t self end |
#to_entry_string ⇒ Object
48 49 50 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 48 def to_entry_string @text.force_encoding("UTF-8") end |
#to_translation_entry(filename) ⇒ Object
Since Expression is an abstract class, no output is generated (descendants redefine this method)
44 45 46 |
# File 'lib/zlocalize/rdoc_source_parser.rb', line 44 def to_translation_entry(filename) nil end |