Method: ActiveDocument::Base#initialize

Defined in:
lib/ActiveDocument/active_document.rb

#initialize(xml_string = "", uri = "nil") ⇒ Base

create a new instance with an optional xml string to use for constructing the model



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/ActiveDocument/active_document.rb', line 75

def initialize(xml_string = "", uri = "nil")
  @document = Nokogiri::XML(xml_string) do |config|
    config.noblanks
  end
  if !xml_string.empty? and self.class.my_root.nil? then
    @root = @document.root.name
  else
    @root = self.class.my_root
  end
  @uri = uri
end