Skip to content

Commit 2f9590f

Browse files
authored
Merge pull request ruby-docx#130 from pjsk-stripe/remove-monkey-patching
Remove monkey patching on Module
2 parents 471eb15 + 5c0176b commit 2f9590f

File tree

4 files changed

+17
-177
lines changed

4 files changed

+17
-177
lines changed

lib/docx.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ module Docx #:nodoc:
44
autoload :Document, 'docx/document'
55
end
66

7-
require 'docx/core_ext/module'

lib/docx/core_ext/module.rb

Lines changed: 0 additions & 172 deletions
This file was deleted.

lib/docx/elements/element.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ def self.included(base)
1414
end
1515

1616
attr_accessor :node
17-
delegate :at_xpath, :xpath, :to => :@node
1817

1918
# TODO: Should create a docx object from this
2019
def parent(type = '*')
2120
@node.at_xpath("./parent::#{type}")
2221
end
2322

23+
def at_xpath(*args)
24+
@node.at_xpath(*args)
25+
end
26+
27+
def xpath(*args)
28+
@node.xpath(*args)
29+
end
30+
2431
# Get parent paragraph of element
2532
def parent_paragraph
2633
Elements::Containers::Paragraph.new(parent('w:p'))
@@ -102,4 +109,4 @@ def create_within(element)
102109
end
103110
end
104111
end
105-
end
112+
end

lib/docx/elements/text.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@ module Docx
22
module Elements
33
class Text
44
include Element
5-
delegate :content, :content=, :to => :@node
65

76
def self.tag
87
't'
98
end
109

10+
def content
11+
@node.content
12+
end
13+
14+
def content=(args)
15+
@node.content = args
16+
end
1117

1218
def initialize(node)
1319
@node = node
1420
end
1521
end
1622
end
17-
end
23+
end

0 commit comments

Comments
 (0)