Class: ERBook::Document
- Inherits:
-
Object
- Object
- ERBook::Document
- Defined in:
- lib/erbook/document.rb
Defined Under Namespace
Classes: Node
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Data from the format specification file.
-
#nodes ⇒ Object
readonly
All nodes in the document.
-
#nodes_by_type ⇒ Object
readonly
All nodes in the document arranged by node type.
-
#roots ⇒ Object
readonly
All root nodes in the document.
Instance Method Summary collapse
-
#initialize(format_name, input_text, input_file, options = {}) ⇒ Document
constructor
Parameters.
-
#to_s ⇒ Object
Returns the output of this document.
Constructor Details
#initialize(format_name, input_text, input_file, options = {}) ⇒ Document
Parameters
- format_name
-
Either the short-hand name of a built-in format or the path to a format specification file.
- input_text
-
The body of the input document.
- input_file
-
Name of the file from which the input document originated.
Options
- :unindent
-
If true, all node content is unindented hierarchically.
42 43 44 45 46 47 48 49 50 |
# File 'lib/erbook/document.rb', line 42 def initialize format_name, input_text, input_file, = {} load_format format_name @input_text = input_text @input_file = input_file @options = process_input_document end |
Instance Attribute Details
#format ⇒ Object (readonly)
Data from the format specification file.
13 14 15 |
# File 'lib/erbook/document.rb', line 13 def format @format end |
#nodes ⇒ Object (readonly)
All nodes in the document.
19 20 21 |
# File 'lib/erbook/document.rb', line 19 def nodes @nodes end |
#nodes_by_type ⇒ Object (readonly)
All nodes in the document arranged by node type.
22 23 24 |
# File 'lib/erbook/document.rb', line 22 def nodes_by_type @nodes_by_type end |
#roots ⇒ Object (readonly)
All root nodes in the document.
16 17 18 |
# File 'lib/erbook/document.rb', line 16 def roots @roots end |