Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/builder/xchar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.check_for_name_collision(klass, method_name, defined_constant=nil)

if ! defined?(Builder::XChar) and ! String.method_defined?(:encode)
Builder.check_for_name_collision(String, "to_xs")
Builder.check_for_name_collision(Fixnum, "xchr")
Builder.check_for_name_collision(Integer, "xchr")
end

######################################################################
Expand Down Expand Up @@ -108,7 +108,7 @@ module XChar # :nodoc:
INVALID_XML_CHAR = Regexp.new('[^'+
Builder::XChar::VALID.map { |item|
case item
when Fixnum
when Integer
[item].pack('U').force_encoding('utf-8')
when Range
[item.first, '-'.ord, item.last].pack('UUU').force_encoding('utf-8')
Expand Down Expand Up @@ -160,9 +160,9 @@ def XChar.encode(string)
else

######################################################################
# Enhance the Fixnum class with a XML escaped character conversion.
# Enhance the Integer class with a XML escaped character conversion.
#
class Fixnum
class Integer
XChar = Builder::XChar if ! defined?(XChar)

# XML escaped version of chr. When <tt>escape</tt> is set to false
Expand Down