deprecated RegexpOfHolding and XMLToRuby

This commit is contained in:
Kyle Banker 2010-01-07 16:17:34 -05:00
parent 9fd352ec87
commit 1e183d1f53
2 changed files with 10 additions and 0 deletions

View File

@ -28,10 +28,13 @@ module Mongo
attr_accessor :extra_options_str
# @deprecated we're no longer supporting this.
# +str+ and +options+ are the same as Regexp. +extra_options_str+
# contains all the other flags that were in Mongo but we do not use or
# understand.
def initialize(str, options, extra_options_str)
warn "RegexpOfHolding is deprecated; the modifiers i, m, and x will be stored automatically as BSON." +
"If you're only storing the options i, m, and x, you can safely ignore this message."
super(str, options)
@extra_options_str = extra_options_str
end

View File

@ -17,6 +17,7 @@
require 'rexml/document'
require 'mongo'
# @deprecated
# Converts a .xson file (an XML file that describes a Mongo-type document) to
# an OrderedHash.
class XMLToRuby
@ -24,6 +25,7 @@ class XMLToRuby
include Mongo
def xml_to_ruby(io)
warn "XMLToRuby is deprecated. The .xson format is not longer in use."
doc = REXML::Document.new(io)
doc_to_ruby(doc.root.elements['doc'])
end
@ -31,6 +33,7 @@ class XMLToRuby
protected
def element_to_ruby(e)
warn "XMLToRuby is deprecated. The .xson format is not longer in use."
type = e.name
child = e.elements[1]
case type
@ -71,12 +74,14 @@ class XMLToRuby
end
def doc_to_ruby(element)
warn "XMLToRuby is deprecated. The .xson format is not longer in use."
oh = OrderedHash.new
element.elements.each { |e| oh[e.attributes['name']] = element_to_ruby(e) }
oh
end
def array_to_ruby(elements)
warn "XMLToRuby is deprecated. The .xson format is not longer in use."
a = []
elements.each { |e|
index_str = e.attributes['name']
@ -86,6 +91,7 @@ class XMLToRuby
end
def regex_to_ruby(elements)
warn "XMLToRuby is deprecated. The .xson format is not longer in use."
pattern = elements['pattern'].text
options_str = elements['options'].text || ''
@ -97,6 +103,7 @@ class XMLToRuby
end
def dbref_to_ruby(elements)
warn "XMLToRuby is deprecated. The .xson format is not longer in use."
ns = elements['ns'].text
oid_str = elements['oid'].text
DBRef.new(ns, ObjectID.from_string(oid_str))