Method: PdfExtract::XmlView#get_xml_attributes

Defined in:
lib/view/xml_view.rb

#get_xml_attributes(obj, parent = true) ⇒ Object

Return renderable attributes



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/view/xml_view.rb', line 18

def get_xml_attributes obj, parent=true
  attribs = obj.reject { |k, _| @@ignored_attributes.include? k }
  if parent
    attribs = attribs.reject { |k, _| @@parent_ignored_attributes.include? k }
  end
  attribs = attribs.reject { |_, v| v.kind_of?(Hash) || v.kind_of?(Array) }
  attribs.each_pair do |k, v|
    if @@numeric_attributes.include?(k) || k.to_s =~ /.+_score/
      attribs[k] = v.round(@render_options[:round])
    end
  end
  attribs
end