Sha256: e670e6a351ad3b02748709acd2e5c140edcedb01f2e28759ad3b1cc7ca47a526

Contents?: true

Size: 691 Bytes

Versions: 6

Compression:

Stored size: 691 Bytes

Contents

module DMark
  class ElementNode
    attr_reader :name
    attr_reader :attributes
    attr_reader :children

    def initialize(name, attributes, children)
      @name = name
      @attributes = attributes
      @children = children
    end

    def inspect
      io = ''
      io << 'Element(' << @name << ', '
      if @attributes.any?
        io << @attributes.inspect
        io << ', '
      end
      io << @children.inspect
      io << ')'
      io
    end

    def ==(other)
      case other
      when ElementNode
        @name == other.name &&
          @children == other.children &&
          @attributes == other.attributes
      else
        false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
d-mark-1.0.0b2 lib/d-mark/element_node.rb
d-mark-1.0.0b1 lib/d-mark/element_node.rb
d-mark-1.0.0a4 lib/d-mark/element_node.rb
d-mark-1.0.0a3 lib/d-mark/element_node.rb
d-mark-1.0.0a2 lib/d-mark/element_node.rb
d-mark-1.0.0a1 lib/d-mark/element_node.rb