Class: Nanaimo::Writer
- Inherits:
-
Object
- Object
- Nanaimo::Writer
- Defined in:
- lib/nanaimo/writer.rb,
lib/nanaimo/writer/xml.rb
Overview
Transforms native ruby objects or Plist objects into their ASCII Plist string representation.
Direct Known Subclasses
Defined Under Namespace
Classes: XMLWriter
Constant Summary collapse
- UTF8 =
The magic comment that denotes a UTF8-encoded plist.
"// !$*UTF8*$!\n".freeze
Instance Method Summary collapse
-
#initialize(plist, pretty = true, output = ::String.new) ⇒ Writer
constructor
A new instance of Writer.
-
#write ⇒ Object
Writes the plist to the given output.
Constructor Details
#initialize(plist, pretty = true, output = ::String.new) ⇒ Writer
Returns a new instance of Writer.
17 18 19 20 21 22 23 |
# File 'lib/nanaimo/writer.rb', line 17 def initialize(plist, pretty = true, output = ::String.new) @plist = plist @pretty = pretty @output = output @indent = 0 @newlines = true end |
Instance Method Details
#write ⇒ Object
Writes the plist to the given output.
27 28 29 30 31 |
# File 'lib/nanaimo/writer.rb', line 27 def write write_utf8 write_object(@plist.root_object) write_newline end |