Skip to content

Commit 8245e15

Browse files
author
miko53
committed
add indent in document_spec, remove document API and pass document through paragrah constructor
1 parent 4e459b0 commit 8245e15

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

lib/docx/containers/paragraph.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ def self.tag
1515

1616
# Child elements: pPr, r, fldSimple, hlink, subDoc
1717
# http://msdn.microsoft.com/en-us/library/office/ee364458(v=office.11).aspx
18-
def initialize(node, document_properties = {})
18+
def initialize(node, document_properties = {}, doc = nil)
1919
@node = node
2020
@properties_tag = 'pPr'
2121
@document_properties = document_properties
2222
@font_size = @document_properties[:font_size]
23-
end
24-
25-
def document=(doc)
2623
@document = doc
2724
end
2825

lib/docx/document.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ def update
210210

211211
# generate Elements::Containers::Paragraph from paragraph XML node
212212
def parse_paragraph_from(p_node)
213-
p = Elements::Containers::Paragraph.new(p_node, document_properties)
214-
p.document = self
215-
p
213+
Elements::Containers::Paragraph.new(p_node, document_properties, self)
216214
end
217215

218216
# generate Elements::Bookmark from bookmark XML node

spec/docx/document_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@
507507

508508
describe 'reading style' do
509509
before do
510-
@doc = Docx::Document.open(@fixtures_path + '/test_with_style.docx')
510+
@doc = Docx::Document.open(@fixtures_path + '/test_with_style.docx')
511511
end
512512

513513
it 'read default style when not' do

0 commit comments

Comments
 (0)