Module: ActiveSupport::XmlMini_NokogiriSAX

Extended by:
XmlMini_NokogiriSAX
Included in:
XmlMini_NokogiriSAX
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/xml_mini/nokogirisax.rb

Overview

:nodoc:

Defined Under Namespace

Classes: HashBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#document_classObject

Returns the value of attribute document_class.



68
69
70
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/xml_mini/nokogirisax.rb', line 68

def document_class
  @document_class
end

Instance Method Details

#parse(data) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/xml_mini/nokogirisax.rb', line 71

def parse(data)
  if !data.respond_to?(:read)
    data = StringIO.new(data || "")
  end

  if data.eof?
    {}
  else
    document = document_class.new
    parser = Nokogiri::XML::SAX::Parser.new(document)
    parser.parse(data)
    document.hash
  end
end