Class: Moxml::Text
Instance Attribute Summary
Attributes inherited from Node
#native
Instance Method Summary
collapse
Methods inherited from Node
#add_next_sibling, #add_previous_sibling, #children, #column, #inner_html, #inner_html=, #line, #next_sibling, #outer_html, #parent, #path, #previous_sibling, #remove, #replace, #text, #text=, wrap
Constructor Details
#initialize(content_or_native = nil) ⇒ Text
Returns a new instance of Text.
3
4
5
6
7
8
9
10
|
# File 'lib/moxml/text.rb', line 3
def initialize(content_or_native = nil)
case content_or_native
when String
super(adapter.create_text(nil, content_or_native))
else
super(content_or_native)
end
end
|
Instance Method Details
#blank? ⇒ Boolean
21
22
23
|
# File 'lib/moxml/text.rb', line 21
def blank?
content.strip.empty?
end
|
#cdata? ⇒ Boolean
25
26
27
|
# File 'lib/moxml/text.rb', line 25
def cdata?
false
end
|
#content ⇒ Object
12
13
14
|
# File 'lib/moxml/text.rb', line 12
def content
adapter.text_content(native)
end
|
#content=(text) ⇒ Object
16
17
18
19
|
# File 'lib/moxml/text.rb', line 16
def content=(text)
adapter.set_text_content(native, text)
self
end
|
#text? ⇒ Boolean
29
30
31
|
# File 'lib/moxml/text.rb', line 29
def text?
true
end
|