Parent

REXMLUtilityNode

This is a slighly modified version of the XMLUtilityNode from merb.devjavu.com/projects/merb/ticket/95 (has.sox@gmail.com) It’s mainly just adding vowels, as I ht cd wth n vwls :) This represents the hard part of the work, all I did was change the underlying parser.

Attributes

name[RW]
attributes[RW]
children[RW]
type[RW]

Public Class Methods

new(name, attributes = {}) click to toggle source
     # File lib/extlib/hash.rb, line 289
289:   def initialize(name, attributes = {})
290:     @name         = name.tr("-", "_")
291:     # leave the type alone if we don't know what it is
292:     @type         = self.class.available_typecasts.include?(attributes["type"]) ? attributes.delete("type") : attributes["type"]
293: 
294:     @nil_element  = attributes.delete("nil") == "true"
295:     @attributes   = undasherize_keys(attributes)
296:     @children     = []
297:     @text         = false
298:   end

Public Instance Methods

add_node(node) click to toggle source
     # File lib/extlib/hash.rb, line 300
300:   def add_node(node)
301:     @text = true if node.is_a? String
302:     @children << node
303:   end
to_hash() click to toggle source
     # File lib/extlib/hash.rb, line 305
305:   def to_hash
306:     if @type == "file"
307:       f = StringIO.new((@children.first || '').unpack('m').first)
308:       class << f
309:         attr_accessor :original_filename, :content_type
310:       end
311:       f.original_filename = attributes['name'] || 'untitled'
312:       f.content_type = attributes['content_type'] || 'application/octet-stream'
313:       return {name => f}
314:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.