module

ActiveSupport::XmlMini

v3.2.13 - 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_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 { |number| BigDecimal(number) },\n"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.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"Fixnum" => "integer",\n"Bignum" => "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} unless defined?(TYPE_NAMES)

Attributes

[R]backend

Files

  • activesupport/lib/active_support/xml_mini.rb

Nested classes and modules