Properly indent doctype/XML decl inspect values.
This commit is contained in:
parent
37a12722cb
commit
13a9228563
|
@ -27,14 +27,15 @@ module Oga
|
||||||
|
|
||||||
def inspect(indent = 0)
|
def inspect(indent = 0)
|
||||||
class_name = self.class.to_s.split('::').last
|
class_name = self.class.to_s.split('::').last
|
||||||
|
spacing = ' ' * indent
|
||||||
|
|
||||||
return <<-EOF.strip
|
return <<-EOF.strip
|
||||||
#{class_name}(
|
#{class_name}(
|
||||||
name: #{name.inspect}
|
#{spacing} name: #{name.inspect}
|
||||||
type: #{type.inspect}
|
#{spacing} type: #{type.inspect}
|
||||||
public_id: #{public_id.inspect}
|
#{spacing} public_id: #{public_id.inspect}
|
||||||
system_id: #{system_id.inspect}
|
#{spacing} system_id: #{system_id.inspect}
|
||||||
)
|
#{spacing})
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
end # Doctype
|
end # Doctype
|
||||||
|
|
|
@ -35,10 +35,22 @@ module Oga
|
||||||
class_name = self.class.to_s.split('::').last
|
class_name = self.class.to_s.split('::').last
|
||||||
child_lines = children.map { |child| child.inspect(4) }.join("\n")
|
child_lines = children.map { |child| child.inspect(4) }.join("\n")
|
||||||
|
|
||||||
|
if doctype
|
||||||
|
dtd = doctype.inspect(2)
|
||||||
|
else
|
||||||
|
dtd = doctype.inspect
|
||||||
|
end
|
||||||
|
|
||||||
|
if xml_declaration
|
||||||
|
decl = xml_declaration.inspect(2)
|
||||||
|
else
|
||||||
|
decl = xml_declaration.inspect
|
||||||
|
end
|
||||||
|
|
||||||
return <<-EOF.strip
|
return <<-EOF.strip
|
||||||
#{class_name}(
|
#{class_name}(
|
||||||
doctype: #{doctype.inspect}
|
doctype: #{dtd}
|
||||||
xml_declaration: #{xml_declaration.inspect}
|
xml_declaration: #{decl}
|
||||||
children: [
|
children: [
|
||||||
#{child_lines}
|
#{child_lines}
|
||||||
])
|
])
|
||||||
|
|
|
@ -35,15 +35,16 @@ module Oga
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def inspect
|
def inspect(indent = 0)
|
||||||
class_name = self.class.to_s.split('::').last
|
class_name = self.class.to_s.split('::').last
|
||||||
|
spacing = ' ' * indent
|
||||||
|
|
||||||
return <<-EOF.strip
|
return <<-EOF.strip
|
||||||
#{class_name}(
|
#{class_name}(
|
||||||
version: #{version.inspect}
|
#{spacing} version: #{version.inspect}
|
||||||
encoding: #{encoding.inspect}
|
#{spacing} encoding: #{encoding.inspect}
|
||||||
standalone: #{standalone.inspect}
|
#{spacing} standalone: #{standalone.inspect}
|
||||||
)
|
#{spacing})
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
end # XmlDeclaration
|
end # XmlDeclaration
|
||||||
|
|
Loading…
Reference in New Issue