2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/transformator/format_converter/document_from_object.rb', line 2
def document_from_object(obj, options = {})
case Transformator.determine_format(obj)
when :hash
Transformator.document_from_hash(obj)
when :json
Transformator.document_from_json(obj)
when :ox_document
obj
when :xml
Transformator.document_from_xml(
obj,
remove_whitespace_only_text_nodes: false,
remove_namespaces: true
)
when nil
Ox::Document.new(version: "1.0", encoding: "UTF-8")
end
end
|