Class: Peanuts::XML::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/peanuts/xml.rb

Direct Known Subclasses

LibXML::Writer

Class Method Summary collapse

Class Method Details

.method_missing(method, *args, &block) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/peanuts/xml.rb', line 68

def self.method_missing(method, *args, &block)
  case method.to_s
  when /^from_(.*)$/
    new(args.first, $1.to_sym, &block)
  else
    super
  end
end

.new(*args, &block) ⇒ Object



61
62
63
64
65
66
# File 'lib/peanuts/xml.rb', line 61

def self.new(*args, &block)
  cls = self == Writer ? XML.default::Writer : self
  obj = cls.allocate
  obj.send(:initialize, *args, &block)
  obj
end