Class: Peanuts::XML::Reader

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

Direct Known Subclasses

LibXML::Reader

Class Method Summary collapse

Class Method Details

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



50
51
52
53
54
55
56
57
# File 'lib/peanuts/xml.rb', line 50

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



43
44
45
46
47
48
# File 'lib/peanuts/xml.rb', line 43

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