Class: Tcl::Msgcat::Renderer
- Inherits:
-
Object
- Object
- Tcl::Msgcat::Renderer
- Defined in:
- lib/tcl/msgcat/renderer.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#msgs ⇒ Object
readonly
Returns the value of attribute msgs.
Instance Method Summary collapse
-
#initialize(msgs, lang = nil) ⇒ Renderer
constructor
A new instance of Renderer.
- #render ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(msgs, lang = nil) ⇒ Renderer
Returns a new instance of Renderer.
5 6 7 8 9 |
# File 'lib/tcl/msgcat/renderer.rb', line 5 def initialize(msgs, lang=nil) @msgs = msgs @lang = lang @lines = [] end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
4 5 6 |
# File 'lib/tcl/msgcat/renderer.rb', line 4 def lines @lines end |
#msgs ⇒ Object (readonly)
Returns the value of attribute msgs.
4 5 6 |
# File 'lib/tcl/msgcat/renderer.rb', line 4 def msgs @msgs end |
Instance Method Details
#render ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tcl/msgcat/renderer.rb', line 11 def render @lines << "package require mchelper" if (@lang.nil? or @lang.downcase == "root") @lines << "msg_lang {}" else @lines << "msg_lang #{@lang}" end @lines << "" _render(@msgs) self end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/tcl/msgcat/renderer.rb', line 26 def to_s @lines.join("\n") end |