Class: Mhtml::RootDocument
Constant Summary
collapse
- BOUNDARY_PREFIX =
'--'.freeze
Instance Attribute Summary collapse
Attributes inherited from Document
#body, #chunked, #encoding, #file_path, #headers, #is_base_64, #is_quoted_printable, #parser, #root_doc
Instance Method Summary
collapse
Methods inherited from Document
#<<, #header, #on_body, #on_header, #relative_file_path
Constructor Details
#initialize(str = nil) ⇒ RootDocument
Returns a new instance of RootDocument.
7
8
9
10
|
# File 'lib/mhtml/root_document.rb', line 7
def initialize(str = nil)
@sub_docs = []
super(str)
end
|
Instance Attribute Details
#boundary ⇒ Object
Returns the value of attribute boundary.
5
6
7
|
# File 'lib/mhtml/root_document.rb', line 5
def boundary
@boundary
end
|
#sub_docs ⇒ Object
Returns the value of attribute sub_docs.
5
6
7
|
# File 'lib/mhtml/root_document.rb', line 5
def sub_docs
@sub_docs
end
|
Instance Method Details
#==(other) ⇒ Object
12
13
14
|
# File 'lib/mhtml/root_document.rb', line 12
def ==(other)
super(other) && @boundary == other.boundary && @sub_docs == other.sub_docs
end
|
#boundary_str ⇒ Object
32
33
34
|
# File 'lib/mhtml/root_document.rb', line 32
def boundary_str
"#{Mhtml::LINE_BREAK}#{BOUNDARY_PREFIX}#{@boundary}#{Mhtml::LINE_BREAK}"
end
|
#last_boundary_str ⇒ Object
36
37
38
|
# File 'lib/mhtml/root_document.rb', line 36
def last_boundary_str
"#{Mhtml::LINE_BREAK}#{BOUNDARY_PREFIX}#{@boundary}#{BOUNDARY_PREFIX}#{Mhtml::LINE_BREAK}"
end
|
#on_subdoc_begin ⇒ Object
16
17
18
|
# File 'lib/mhtml/root_document.rb', line 16
def on_subdoc_begin
@subdoc_begin_proc = Proc.new
end
|
#on_subdoc_body ⇒ Object
24
25
26
|
# File 'lib/mhtml/root_document.rb', line 24
def on_subdoc_body
@subdoc_body_proc = Proc.new
end
|
#on_subdoc_complete ⇒ Object
28
29
30
|
# File 'lib/mhtml/root_document.rb', line 28
def on_subdoc_complete
@subdoc_complete_proc = Proc.new
end
|
20
21
22
|
# File 'lib/mhtml/root_document.rb', line 20
def
= Proc.new
end
|
#to_s ⇒ Object
for testing only = no spec implemented
41
42
43
44
45
|
# File 'lib/mhtml/root_document.rb', line 41
def to_s
doc_sep = Mhtml::DOUBLE_LINE_BREAK + BOUNDARY_PREFIX + @boundary +
Mhtml::LINE_BREAK
super + doc_sep + @sub_docs.join(doc_sep)
end
|