Class: BookmarkMachine::NetscapeFormatter
- Inherits:
-
Object
- Object
- BookmarkMachine::NetscapeFormatter
- Defined in:
- lib/bookmark_machine/netscape_formatter.rb
Overview
Formatter for the Netscape Bookmark File format. Amusingly, the best documentation for the format comes from Microsoft.
https://msdn.microsoft.com/en-us/library/aa753582(v=vs.85).aspx
We live in interesting times.
Defined Under Namespace
Classes: Writer
Instance Attribute Summary collapse
-
#bookmarks ⇒ Object
readonly
Returns the value of attribute bookmarks.
Instance Method Summary collapse
-
#initialize(bookmarks) ⇒ NetscapeFormatter
constructor
A new instance of NetscapeFormatter.
-
#to_html ⇒ Object
(also: #to_s)
Returns an Array of Bookmark objects.
Constructor Details
#initialize(bookmarks) ⇒ NetscapeFormatter
Returns a new instance of NetscapeFormatter.
13 14 15 |
# File 'lib/bookmark_machine/netscape_formatter.rb', line 13 def initialize(bookmarks) @bookmarks = bookmarks end |
Instance Attribute Details
#bookmarks ⇒ Object (readonly)
Returns the value of attribute bookmarks.
11 12 13 |
# File 'lib/bookmark_machine/netscape_formatter.rb', line 11 def bookmarks @bookmarks end |
Instance Method Details
#to_html ⇒ Object Also known as: to_s
Returns an Array of Bookmark objects.
18 19 20 21 22 23 24 25 |
# File 'lib/bookmark_machine/netscape_formatter.rb', line 18 def to_html writer = Writer.new(StringIO.new) bookmarks.each{|b| writer << b } writer.done writer.io.string end |