module

ActiveSupport::XmlMini

v6.1.7.7 - Show latest stable

XmlMini

To use the much faster libxml parser:

gem 'libxml-ruby', '=0.9.7'
XmlMini.backend = 'LibXML'

Constants

DEFAULT_ENCODINGS = {\n"binary" => "base64"\n} unless defined?(DEFAULT_ENCODINGS)

FORMATTING = {\n"symbol" => Proc.new { |symbol| symbol.to_s },\n"date" => Proc.new { |date| date.to_s(:db) },\n"dateTime" => Proc.new { |time| time.xmlschema },\n"binary" => Proc.new { |binary| ::Base64.encode64(binary) },\n"yaml" => Proc.new { |yaml| yaml.to_yaml }\n} unless defined?(FORMATTING)

PARSING = {\n"symbol" => Proc.new { |symbol| symbol.to_s.to_sym },\n"date" => Proc.new { |date| ::Date.parse(date) },\n"datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc },\n"integer" => Proc.new { |integer| integer.to_i },\n"float" => Proc.new { |float| float.to_f },\n"decimal" => Proc.new do |number|\nif String === number\nnumber.to_d\nelse\nBigDecimal(number)\nend\nend,\n"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) },\n"string" => Proc.new { |string| string.to_s },\n"yaml" => Proc.new { |yaml| YAML.load(yaml) rescue yaml },\n"base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },\n"binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) },\n"file" => Proc.new { |file, entity| _parse_file(file, entity) }\n}

TYPE_NAMES = {\n"Symbol" => "symbol",\n"Integer" => "integer",\n"BigDecimal" => "decimal",\n"Float" => "float",\n"TrueClass" => "boolean",\n"FalseClass" => "boolean",\n"Date" => "date",\n"DateTime" => "dateTime",\n"Time" => "dateTime",\n"Array" => "array",\n"Hash" => "hash"\n}

Attributes

[RW]depth

Files

  • activesupport/lib/active_support/xml_mini.rb

Nested classes and modules