json_builder 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/json_builder/xchar.rb +1 -15
- data/lib/test.rb +1 -0
- metadata +2 -2
data/lib/json_builder/xchar.rb
CHANGED
@@ -8,20 +8,6 @@
|
|
8
8
|
# If the JsonBuilder::XChar module is not currently defined, fail on any
|
9
9
|
# name clashes in standard library classes.
|
10
10
|
|
11
|
-
module JsonBuilder
|
12
|
-
def self.check_for_name_collision(klass, method_name, defined_constant=nil)
|
13
|
-
if klass.instance_methods.include?(method_name.to_s)
|
14
|
-
fail RuntimeError,
|
15
|
-
"Name Collision: Method '#{method_name}' is already defined in #{klass}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
if ! defined?(JsonBuilder::XChar)
|
21
|
-
JsonBuilder.check_for_name_collision(String, "to_xs")
|
22
|
-
JsonBuilder.check_for_name_collision(Fixnum, "xchr")
|
23
|
-
end
|
24
|
-
|
25
11
|
######################################################################
|
26
12
|
module JsonBuilder
|
27
13
|
|
@@ -87,7 +73,7 @@ end
|
|
87
73
|
# Enhance the Fixnum class with a XML escaped character conversion.
|
88
74
|
#
|
89
75
|
class Fixnum
|
90
|
-
XChar = JsonBuilder::XChar if !
|
76
|
+
XChar = JsonBuilder::XChar if !defined?(XChar)
|
91
77
|
|
92
78
|
# XML escaped version of chr. When <tt>escape</tt> is set to false
|
93
79
|
# the CP1252 fix is still applied but utf-8 characters are not
|
data/lib/test.rb
CHANGED