Sha256: 5c005fb5112f757def030cd63fddde08448b0469c984e349c1abde0fdcb8d16b
Contents?: true
Size: 652 Bytes
Versions: 1
Compression:
Stored size: 652 Bytes
Contents
module Pump class Xml class Node attr_reader :name, :attributes, :nodes, :options attr_writer :level def initialize(name, attributes={}, nodes=[], options={}) @name = name @attributes = attributes || {} @options = options || {} @nodes = [] Array(nodes).each{|node| add_node(node) } end def to_s end private def add_node(node) node.level = level + 1 nodes << node end def level @level || options[:level] || 0 end def indent (level)*(options[:indent] || 2) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pump-0.0.1 | lib/pump/xml/node.rb |