Builder on 1.9
Like with REXML, I ported XML Builder to run on Ruby version 1.9. As there is likely to be an extended transition period between 1.8 and 2.0, the design goal was to build a single library that supports both.
Major:
- As Ruby 1.9’s support for regular expressions is fully unicode aware, tr and Regexp are used in place of pack and unpack. Should be a major performance win, especially with big strings.
- no more need for
String.to_xs
andFixnum.xchr
- move from BlankSlate to BasicObject. As it doesn’t include
::Kernel
, BasicObject is much more brutal than BlankSlate. Constants like::String
must be explicitly qualified, as do methods like::Kernel.raise
and::Kernel.block_given?
- Since the use of
$KCODE
produces warnings on Ruby 1.9, this support has been removed from Builder when running on Ruby 1.9. New default (absent$KCODE
) switches from “doesn’t understand utf-8” to “supports utf-8”. This means that there will be fewer cases where non-ASCII characters are replaced with XML numeric character references.
Minor:
- trend is towards replacing
assert_raises
withassert_raise
- instance_methods are no longer an array of strings, instead it is an array of symbols. Replace
instance_methods.include?
withmethod_defined?
Uninvestigated/Todo:
. Update: done.Builder::CSS
relies oninstance_eval
. BasicObject support for this method is under active discussionwhat is the equivalent to rake/contrib/sshpublisher in Ruby 1.9?. Updated: solved.- how this affects alternative implementations like JRuby and IronRuby
use U+FFFD instead of*
to indicate invalid Unicode charactersneed to stop the blankslate (and for now, css) tests from running on 1.9integrating this patch