Added XML::Node#html? and XML::Node#xml?

The former has been moved over from XML::Text, the latter just inverts
html?.
This commit is contained in:
Yorick Peterse committed 2015-03-26 01:02:32 +01:00
1 parent 4ad502958d
commit b6fcd326ef
3 files changed
+48 -11

No files matched your search

+16
View File
@@ -163,6 +163,22 @@ module Oga
node_set.insert(index, other)
end
##
# @return [TrueClass|FalseClass]
#
def html?
root = root_node
return root.is_a?(Document) && root.html?
end
##
# @return [TrueClass|FalseClass]
#
def xml?
return !html?
end
end # Element
end # XML
end # Oga
-11
View File
@@ -48,17 +48,6 @@ module Oga
return Entities.encode(super)
end
private
##
# @return [TrueClass|FalseClass]
#
def html?
root = root_node
return root.is_a?(Document) && root.html?
end
end # Text
end # XML
end # Oga