Class: KDL::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/kdl/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nodes) ⇒ Document

Returns a new instance of Document.



5
6
7
# File 'lib/kdl/document.rb', line 5

def initialize(nodes)
  @nodes = nodes
end

Instance Attribute Details

#nodesObject

Returns the value of attribute nodes.



3
4
5
# File 'lib/kdl/document.rb', line 3

def nodes
  @nodes
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
# File 'lib/kdl/document.rb', line 13

def ==(other)
  return false unless other.is_a?(Document)

  nodes == other.nodes
end

#to_sObject



9
10
11
# File 'lib/kdl/document.rb', line 9

def to_s
  @nodes.map(&:to_s).join("\n") + "\n"
end