From 7a8fce246e79f9791f26395b81468e3fe1a694a0 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Sat, 24 Dec 2011 15:52:14 +0100 Subject: generated documentation --- doc/apple-touch-icon.png | Bin 0 -> 86447 bytes doc/classes/BigDecimal.html | 226 +++ doc/classes/Class.html | 139 ++ doc/classes/Complex.html | 227 +++ doc/classes/Date.html | 240 +++ doc/classes/DateTime.html | 256 +++ doc/classes/Exception.html | 240 +++ doc/classes/JSON.html | 1142 +++++++++++++ doc/classes/JSON/CircularDatastructure.html | 75 + doc/classes/JSON/Ext.html | 94 ++ doc/classes/JSON/Ext/Generator.html | 96 ++ .../JSON/Ext/Generator/GeneratorMethods.html | 125 ++ .../JSON/Ext/Generator/GeneratorMethods/Array.html | 127 ++ .../Ext/Generator/GeneratorMethods/Bignum.html | 125 ++ .../Ext/Generator/GeneratorMethods/FalseClass.html | 125 ++ .../Ext/Generator/GeneratorMethods/Fixnum.html | 125 ++ .../JSON/Ext/Generator/GeneratorMethods/Float.html | 125 ++ .../JSON/Ext/Generator/GeneratorMethods/Hash.html | 128 ++ .../Ext/Generator/GeneratorMethods/NilClass.html | 124 ++ .../Ext/Generator/GeneratorMethods/Object.html | 133 ++ .../Ext/Generator/GeneratorMethods/String.html | 281 ++++ .../Generator/GeneratorMethods/String/Extend.html | 129 ++ .../Ext/Generator/GeneratorMethods/TrueClass.html | 124 ++ doc/classes/JSON/Ext/Generator/State.html | 1684 ++++++++++++++++++++ doc/classes/JSON/Ext/Parser.html | 415 +++++ doc/classes/JSON/GeneratorError.html | 81 + doc/classes/JSON/JSONError.html | 81 + doc/classes/JSON/MissingUnicodeSupport.html | 82 + doc/classes/JSON/NestingError.html | 82 + doc/classes/JSON/ParserError.html | 81 + doc/classes/JSON/Pure.html | 96 ++ doc/classes/JSON/Pure/Generator.html | 85 + .../JSON/Pure/Generator/GeneratorMethods.html | 120 ++ .../Pure/Generator/GeneratorMethods/Array.html | 129 ++ .../Generator/GeneratorMethods/FalseClass.html | 122 ++ .../Pure/Generator/GeneratorMethods/Float.html | 140 ++ .../JSON/Pure/Generator/GeneratorMethods/Hash.html | 130 ++ .../Pure/Generator/GeneratorMethods/Integer.html | 122 ++ .../Pure/Generator/GeneratorMethods/NilClass.html | 121 ++ .../Pure/Generator/GeneratorMethods/Object.html | 125 ++ .../Pure/Generator/GeneratorMethods/String.html | 283 ++++ .../Generator/GeneratorMethods/String/Extend.html | 132 ++ .../Pure/Generator/GeneratorMethods/TrueClass.html | 121 ++ doc/classes/JSON/Pure/Generator/State.html | 748 +++++++++ doc/classes/JSON/Pure/Parser.html | 620 +++++++ doc/classes/Kernel.html | 69 + doc/classes/OpenStruct.html | 238 +++ doc/classes/Range.html | 238 +++ doc/classes/Rational.html | 227 +++ doc/classes/Regexp.html | 239 +++ doc/classes/Struct.html | 239 +++ doc/classes/Symbol.html | 237 +++ doc/classes/Time.html | 244 +++ doc/created.rid | 24 + doc/css/github.css | 129 ++ doc/css/main.css | 326 ++++ doc/css/panel.css | 384 +++++ doc/css/reset.css | 48 + doc/favicon.ico | Bin 0 -> 1150 bytes doc/files/README_rdoc.html | 493 ++++++ doc/files/ext/json/ext/generator/generator_c.html | 67 + doc/files/ext/json/ext/parser/parser_c.html | 67 + doc/files/lib/json/add/bigdecimal_rb.html | 88 + doc/files/lib/json/add/complex_rb.html | 88 + doc/files/lib/json/add/core_rb.html | 96 ++ doc/files/lib/json/add/date_rb.html | 88 + doc/files/lib/json/add/date_time_rb.html | 88 + doc/files/lib/json/add/exception_rb.html | 86 + doc/files/lib/json/add/ostruct_rb.html | 88 + doc/files/lib/json/add/range_rb.html | 86 + doc/files/lib/json/add/rational_rb.html | 88 + doc/files/lib/json/add/regexp_rb.html | 86 + doc/files/lib/json/add/struct_rb.html | 86 + doc/files/lib/json/add/symbol_rb.html | 86 + doc/files/lib/json/add/time_rb.html | 86 + doc/files/lib/json/common_rb.html | 128 ++ doc/files/lib/json/ext_rb.html | 97 ++ doc/files/lib/json/pure/generator_rb.html | 148 ++ doc/files/lib/json/pure/parser_rb.html | 96 ++ doc/files/lib/json/pure_rb.html | 97 ++ doc/files/lib/json/version_rb.html | 78 + doc/files/lib/json_rb.html | 156 ++ doc/i/arrows.png | Bin 0 -> 477 bytes doc/i/results_bg.png | Bin 0 -> 696 bytes doc/i/tree_bg.png | Bin 0 -> 207 bytes doc/index.html | 13 + doc/js/highlight.pack.js | 1 + doc/js/jquery-1.3.2.min.js | 19 + doc/js/jquery-effect.js | 593 +++++++ doc/js/main.js | 24 + doc/js/navigation.js | 142 ++ doc/js/search_index.js | 1 + doc/js/searchdoc.js | 442 +++++ doc/js/searcher.js | 228 +++ doc/panel/index.html | 73 + doc/panel/links.html | 52 + doc/panel/tree.js | 1 + 97 files changed, 16804 insertions(+) create mode 100644 doc/apple-touch-icon.png create mode 100644 doc/classes/BigDecimal.html create mode 100644 doc/classes/Class.html create mode 100644 doc/classes/Complex.html create mode 100644 doc/classes/Date.html create mode 100644 doc/classes/DateTime.html create mode 100644 doc/classes/Exception.html create mode 100644 doc/classes/JSON.html create mode 100644 doc/classes/JSON/CircularDatastructure.html create mode 100644 doc/classes/JSON/Ext.html create mode 100644 doc/classes/JSON/Ext/Generator.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/Array.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/Float.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/Hash.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/Object.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/String.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html create mode 100644 doc/classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html create mode 100644 doc/classes/JSON/Ext/Generator/State.html create mode 100644 doc/classes/JSON/Ext/Parser.html create mode 100644 doc/classes/JSON/GeneratorError.html create mode 100644 doc/classes/JSON/JSONError.html create mode 100644 doc/classes/JSON/MissingUnicodeSupport.html create mode 100644 doc/classes/JSON/NestingError.html create mode 100644 doc/classes/JSON/ParserError.html create mode 100644 doc/classes/JSON/Pure.html create mode 100644 doc/classes/JSON/Pure/Generator.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/Array.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/Float.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/Hash.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/Integer.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/Object.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/String.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html create mode 100644 doc/classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html create mode 100644 doc/classes/JSON/Pure/Generator/State.html create mode 100644 doc/classes/JSON/Pure/Parser.html create mode 100644 doc/classes/Kernel.html create mode 100644 doc/classes/OpenStruct.html create mode 100644 doc/classes/Range.html create mode 100644 doc/classes/Rational.html create mode 100644 doc/classes/Regexp.html create mode 100644 doc/classes/Struct.html create mode 100644 doc/classes/Symbol.html create mode 100644 doc/classes/Time.html create mode 100644 doc/created.rid create mode 100644 doc/css/github.css create mode 100755 doc/css/main.css create mode 100755 doc/css/panel.css create mode 100755 doc/css/reset.css create mode 100644 doc/favicon.ico create mode 100644 doc/files/README_rdoc.html create mode 100644 doc/files/ext/json/ext/generator/generator_c.html create mode 100644 doc/files/ext/json/ext/parser/parser_c.html create mode 100644 doc/files/lib/json/add/bigdecimal_rb.html create mode 100644 doc/files/lib/json/add/complex_rb.html create mode 100644 doc/files/lib/json/add/core_rb.html create mode 100644 doc/files/lib/json/add/date_rb.html create mode 100644 doc/files/lib/json/add/date_time_rb.html create mode 100644 doc/files/lib/json/add/exception_rb.html create mode 100644 doc/files/lib/json/add/ostruct_rb.html create mode 100644 doc/files/lib/json/add/range_rb.html create mode 100644 doc/files/lib/json/add/rational_rb.html create mode 100644 doc/files/lib/json/add/regexp_rb.html create mode 100644 doc/files/lib/json/add/struct_rb.html create mode 100644 doc/files/lib/json/add/symbol_rb.html create mode 100644 doc/files/lib/json/add/time_rb.html create mode 100644 doc/files/lib/json/common_rb.html create mode 100644 doc/files/lib/json/ext_rb.html create mode 100644 doc/files/lib/json/pure/generator_rb.html create mode 100644 doc/files/lib/json/pure/parser_rb.html create mode 100644 doc/files/lib/json/pure_rb.html create mode 100644 doc/files/lib/json/version_rb.html create mode 100644 doc/files/lib/json_rb.html create mode 100755 doc/i/arrows.png create mode 100755 doc/i/results_bg.png create mode 100755 doc/i/tree_bg.png create mode 100644 doc/index.html create mode 100755 doc/js/highlight.pack.js create mode 100755 doc/js/jquery-1.3.2.min.js create mode 100755 doc/js/jquery-effect.js create mode 100755 doc/js/main.js create mode 100644 doc/js/navigation.js create mode 100644 doc/js/search_index.js create mode 100755 doc/js/searchdoc.js create mode 100644 doc/js/searcher.js create mode 100755 doc/panel/index.html create mode 100644 doc/panel/links.html create mode 100644 doc/panel/tree.js diff --git a/doc/apple-touch-icon.png b/doc/apple-touch-icon.png new file mode 100644 index 0000000..50f98b0 Binary files /dev/null and b/doc/apple-touch-icon.png differ diff --git a/doc/classes/BigDecimal.html b/doc/classes/BigDecimal.html new file mode 100644 index 0000000..d4362c3 --- /dev/null +++ b/doc/classes/BigDecimal.html @@ -0,0 +1,226 @@ + + + + + BigDecimal + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/bigdecimal.rb, line 7
+def self.json_create(object)
+  BigDecimal._load object['b']
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/bigdecimal.rb, line 11
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'b'            => _dump,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/bigdecimal.rb, line 18
+def to_json(*)
+  as_json.to_json
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Class.html b/doc/classes/Class.html new file mode 100644 index 0000000..18ee776 --- /dev/null +++ b/doc/classes/Class.html @@ -0,0 +1,139 @@ + + + + + Class + + + + + + + + + + + + + +
+
+ +
+ +

Extends any Class to include +json_creatable? method.

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
J
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + json_creatable?() + +
+ + +
+

Returns true if this class can be used to create an instance from a +serialised JSON string. The class has to implement +a class method json_create that expects a hash as first parameter. +The hash should include the required data.

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 467
+def json_creatable?
+  respond_to?(:json_create)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Complex.html b/doc/classes/Complex.html new file mode 100644 index 0000000..6c90ef2 --- /dev/null +++ b/doc/classes/Complex.html @@ -0,0 +1,227 @@ + + + + + Complex + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/complex.rb, line 7
+def self.json_create(object)
+  Complex(object['r'], object['i'])
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/complex.rb, line 11
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'r'            => real,
+    'i'            => imag,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/complex.rb, line 19
+def to_json(*)
+  as_json.to_json
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Date.html b/doc/classes/Date.html new file mode 100644 index 0000000..079c6e9 --- /dev/null +++ b/doc/classes/Date.html @@ -0,0 +1,240 @@ + + + + + Date + + + + + + + + + + + + + +
+
+ +
+ +

Date serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by converting Julian year +y, month m, day d and Day of +Calendar Reform sg to Date.

+
+ + + + + + +
+ + +
+
# File lib/json/add/date.rb, line 11
+def self.json_create(object)
+  civil(*object.values_at('y', 'm', 'd', 'sg'))
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/date.rb, line 19
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'y' => year,
+    'm' => month,
+    'd' => day,
+    'sg' => start,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (Date) with Julian year +y, month m, day d and Day of +Calendar Reform sg as JSON string

+
+ + + + + + +
+ + +
+
# File lib/json/add/date.rb, line 31
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/DateTime.html b/doc/classes/DateTime.html new file mode 100644 index 0000000..2819094 --- /dev/null +++ b/doc/classes/DateTime.html @@ -0,0 +1,256 @@ + + + + + DateTime + + + + + + + + + + + + + +
+
+ +
+ +

DateTime serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by converting year +y, month m, day d, hour +H, minute M, second S, offset +of and Day of Calendar Reform sg to DateTime.

+
+ + + + + + +
+ + +
+
# File lib/json/add/date_time.rb, line 12
+def self.json_create(object)
+  args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
+  of_a, of_b = object['of'].split('/')
+  if of_b and of_b != '0'
+    args << Rational(of_a.to_i, of_b.to_i)
+  else
+    args << of_a
+  end
+  args << object['sg']
+  civil(*args)
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/date_time.rb, line 28
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'y' => year,
+    'm' => month,
+    'd' => day,
+    'H' => hour,
+    'M' => min,
+    'S' => sec,
+    'of' => offset.to_s,
+    'sg' => start,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (DateTime) with Julian year +y, month m, day d, hour +H, minute M, second S, offset +of and Day of Calendar Reform sg as JSON string

+
+ + + + + + +
+ + +
+
# File lib/json/add/date_time.rb, line 45
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Exception.html b/doc/classes/Exception.html new file mode 100644 index 0000000..3a25aaa --- /dev/null +++ b/doc/classes/Exception.html @@ -0,0 +1,240 @@ + + + + + Exception + + + + + + + + + + + + + +
+
+ +
+ +

Exception serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by constructing new Exception object with message m and +backtrace b serialized with to_json

+
+ + + + + + +
+ + +
+
# File lib/json/add/exception.rb, line 10
+def self.json_create(object)
+  result = new(object['m'])
+  result.set_backtrace object['b']
+  result
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/exception.rb, line 18
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'm'            => message,
+    'b'            => backtrace,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (Exception) with message +m and backtrace array b as JSON string

+
+ + + + + + +
+ + +
+
# File lib/json/add/exception.rb, line 28
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON.html b/doc/classes/JSON.html new file mode 100644 index 0000000..3b5fb26 --- /dev/null +++ b/doc/classes/JSON.html @@ -0,0 +1,1142 @@ + + + + + JSON + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
#
+
+
    + + +
  • + [] +
  • + +
+
+ +
C
+
+ +
+ +
D
+
+
    + + +
  • + dump +
  • + +
+
+ +
F
+
+ +
+ +
G
+
+ +
+ +
I
+
+ +
+ +
L
+
+
    + + +
  • + load +
  • + +
+
+ +
P
+
+ +
+ +
R
+
+ +
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VERSION='1.6.4'
 

JSON version

VERSION_ARRAY=VERSION.split(/\./).map { |x| x.to_i }
 
VERSION_MAJOR=VERSION_ARRAY[0]
 
VERSION_MINOR=VERSION_ARRAY[1]
 
VERSION_BUILD=VERSION_ARRAY[2]
 
NaN=0.0/0
 
Infinity=1.0/0
 
MinusInfinity=-Infinity
 
UnparserError=GeneratorError
 

For backwards compatibility

MAP={ +"\x0" => '\u0000', +"\x1" => '\u0001', +"\x2" => '\u0002', +"\x3" => '\u0003', +"\x4" => '\u0004', +"\x5" => '\u0005', +"\x6" => '\u0006', +"\x7" => '\u0007', +"\b" => '\b', +"\t" => '\t', +"\n" => '\n', +"\xb" => '\u000b', +"\f" => '\f', +"\r" => '\r', +"\xe" => '\u000e', +"\xf" => '\u000f', +"\x10" => '\u0010', +"\x11" => '\u0011', +"\x12" => '\u0012', +"\x13" => '\u0013', +"\x14" => '\u0014', +"\x15" => '\u0015', +"\x16" => '\u0016', +"\x17" => '\u0017', +"\x18" => '\u0018', +"\x19" => '\u0019', +"\x1a" => '\u001a', +"\x1b" => '\u001b', +"\x1c" => '\u001c', +"\x1d" => '\u001d', +"\x1e" => '\u001e', +"\x1f" => '\u001f', +'"' => '\"', +'\\' => '\\\\', +}
 
JSON_LOADED=true unless defined?(::JSON::JSON_LOADED)
 
+ + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ [RW] + create_id

This is create identifier, which is used to decide if the +json_create hook of a class should be called. It defaults to +‘json_class’.

+ [RW] + dump_default_options

The global default options for the #dump method:

+ +
:max_nesting: false
+:allow_nan: true
+:quirks_mode: true
+ [R] + generator

Returns the JSON generator module that is used by +JSON. This is either JSON::Ext::Generator or JSON::Pure::Generator.

+ [RW] + load_default_options

The global default options for the #load method:

+ +
:max_nesting: false
+:allow_nan: true
+:quirks_mode: true
+ [R] + parser

Returns the JSON parser class that is used by JSON. This is either JSON::Ext::Parser or JSON::Pure::Parser.

+ [RW] + state

Returns the JSON generator state class that is used +by JSON. This is either JSON::Ext::Generator::State or JSON::Pure::Generator::State.

+ + + + + +
Class Public methods
+ +
+
+ + [](object, opts = {}) + +
+ + +
+

If object is string-like, parse the string and return the parsed +result as a Ruby data structure. Otherwise generate a JSON text from the Ruby data structure object and +return it.

+ +

The opts argument is passed through to generate/parse +respectively. See generate and parse for their documentation.

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 11
+def [](object, opts = {})
+  if object.respond_to? :to_str
+    JSON.parse(object.to_str, opts)
+  else
+    JSON.generate(object, opts)
+  end
+end
+
+
+ +
+ +
+
+ + const_defined_in?(modul, constant) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 415
+def self.const_defined_in?(modul, constant)
+  modul.const_defined?(constant)
+end
+
+
+ +
+ +
+
+ + iconv(to, from, string) + +
+ + +
+

Encodes string using Ruby’s String.encode

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 403
+def self.iconv(to, from, string)
+  string.encode(to, from)
+end
+
+
+ +
+ +
+
+ + restore(source, proc = nil) + +
+ + +
+ +
+ + + + + +
+ +
Instance Public methods
+ +
+
+ + dump(obj, anIO = nil, limit = nil) + +
+ + +
+

Dumps obj as a JSON string, i.e. calls +generate on the object and returns the result.

+ +

If anIO (an IO-like object or an object that responds to the write method) +was given, the resulting JSON is written to it.

+ +

If the number of nested arrays or objects exceeds limit, an +ArgumentError exception is raised. This argument is similar (but not +exactly the same!) to the limit argument in Marshal.dump.

+ +

The default options for the generator can be changed via the ::dump_default_options +method.

+ +

This method is part of the implementation of the load/dump interface of +Marshal and YAML.

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 370
+def dump(obj, anIO = nil, limit = nil)
+  if anIO and limit.nil?
+    anIO = anIO.to_io if anIO.respond_to?(:to_io)
+    unless anIO.respond_to?(:write)
+      limit = anIO
+      anIO = nil
+    end
+  end
+  opts = JSON.dump_default_options
+  limit and opts.update(:max_nesting => limit)
+  result = generate(obj, opts)
+  if anIO
+    anIO.write result
+    anIO
+  else
+    result
+  end
+rescue JSON::NestingError
+  raise ArgumentError, "exceed depth limit"
+end
+
+
+ +
+ +
+
+ + fast_generate(obj, opts = nil) + +
+ + +
+

Generate a JSON document from the Ruby data +structure obj and return it. This method disables the checks for +circles in Ruby objects.

+ +

WARNING: Be careful not to pass any Ruby data structures +with circles as obj argument because this will cause JSON to go into an infinite loop.

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 231
+def fast_generate(obj, opts = nil)
+  if State === opts
+    state, opts = opts, nil
+  else
+    state = FAST_STATE_PROTOTYPE.dup
+  end
+  if opts
+    if opts.respond_to? :to_hash
+      opts = opts.to_hash
+    elsif opts.respond_to? :to_h
+      opts = opts.to_h
+    else
+      raise TypeError, "can't convert #{opts.class} into Hash"
+    end
+    state.configure(opts)
+  end
+  state.generate(obj)
+end
+
+
+ +
+ +
+
+ + generate(obj, opts = nil) + +
+ + +
+

Generate a JSON document from the Ruby data +structure obj and return it. state is * a JSON::State +object,

+
  • +

    or a Hash like object (responding to to_hash),

    +
  • +

    an object convertible into a hash by a to_h method,

    +
+ +

that is used as or to configure a State object.

+ +

It defaults to a state object, that creates the shortest possible JSON text in one line, checks for circular data +structures and doesn’t allow NaN, Infinity, and -Infinity.

+ +

A state hash can have the following keys:

+
  • +

    indent: a string used to indent levels (default: ”),

    +
  • +

    space: a string that is put after, a : or , delimiter +(default: ”),

    +
  • +

    space_before: a string that is put before a : pair +delimiter (default: ”),

    +
  • +

    object_nl: a string that is put at the end of a JSON object (default: ”),

    +
  • +

    array_nl: a string that is put at the end of a JSON array (default: ”),

    +
  • +

    allow_nan: true if NaN, Infinity, and -Infinity should be generated, otherwise an +exception is thrown if these values are encountered. This options defaults +to false.

    +
  • +

    max_nesting: The maximum depth of nesting allowed in the +data structures from which JSON is to be generated. +Disable depth checking with :max_nesting => false, it defaults to 19.

    +
+ +

See also the #fast_generate +for the fastest creation method with the least amount of sanity checks, and +the #pretty_generate +method for some defaults for pretty output.

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 200
+def generate(obj, opts = nil)
+  if State === opts
+    state, opts = opts, nil
+  else
+    state = SAFE_STATE_PROTOTYPE.dup
+  end
+  if opts
+    if opts.respond_to? :to_hash
+      opts = opts.to_hash
+    elsif opts.respond_to? :to_h
+      opts = opts.to_h
+    else
+      raise TypeError, "can't convert #{opts.class} into Hash"
+    end
+    state = state.configure(opts)
+  end
+  state.generate(obj)
+end
+
+
+ +
+ +
+
+ + load(source, proc = nil) + +
+ + +
+

Load a ruby data structure from a JSON +source and return it. A source can either be a string-like object, +an IO-like object, or an object responding to the read method. If +proc was given, it will be called with any nested Ruby object as +an argument recursively in depth first order. The default options for the +parser can be changed via the ::load_default_options +method.

+ +

This method is part of the implementation of the load/dump interface of +Marshal and YAML.

+
+ + + +
+ Also aliased as: restore +
+ + + + +
+ + +
+
# File lib/json/common.rb, line 308
+def load(source, proc = nil)
+  opts = load_default_options
+  if source.respond_to? :to_str
+    source = source.to_str
+  elsif source.respond_to? :to_io
+    source = source.to_io.read
+  elsif source.respond_to?(:read)
+    source = source.read
+  end
+  if opts[:quirks_mode] && (source.nil? || source.empty?)
+    source = 'null'
+  end
+  result = parse(source, opts)
+  recurse_proc(result, &proc) if proc
+  result
+end
+
+
+ +
+ +
+
+ + parse(source, opts = {}) + +
+ + +
+

Parse the JSON document source into a Ruby +data structure and return it.

+ +

opts can have the following keys:

+
  • +

    max_nesting: The maximum depth of nesting allowed in the +parsed data structures. Disable depth checking with :max_nesting => +false. It defaults to 19.

    +
  • +

    allow_nan: If set to true, allow NaN, Infinity and +-Infinity in defiance of RFC 4627 to be +parsed by the Parser. This option defaults to false.

    +
  • +

    symbolize_names: If set to true, returns symbols for the +names (keys) in a JSON object. Otherwise strings +are returned. Strings are the default.

    +
  • +

    create_additions: If set to false, the Parser doesn’t +create additions even if a matching class and ::create_id was found. This +option defaults to true.

    +
  • +

    object_class: Defaults to Hash

    +
  • +

    array_class: Defaults to Array

    +
+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 147
+def parse(source, opts = {})
+  Parser.new(source, opts).parse
+end
+
+
+ +
+ +
+
+ + parse!(source, opts = {}) + +
+ + +
+

Parse the JSON document source into a Ruby +data structure and return it. The bang version of the parse method defaults +to the more dangerous values for the opts hash, so be sure only to +parse trusted source documents.

+ +

opts can have the following keys:

+
  • +

    max_nesting: The maximum depth of nesting allowed in the +parsed data structures. Enable depth checking with :max_nesting => +anInteger. The parse! methods defaults to not doing max depth checking: +This can be dangerous if someone wants to fill up your stack.

    +
  • +

    allow_nan: If set to true, allow NaN, Infinity, +and -Infinity in defiance of RFC 4627 to +be parsed by the Parser. This option defaults to true.

    +
  • +

    create_additions: If set to false, the Parser doesn’t +create additions even if a matching class and ::create_id was found. This +option defaults to true.

    +
+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 166
+def parse!(source, opts = {})
+  opts = {
+    :max_nesting  => false,
+    :allow_nan    => true
+  }.update(opts)
+  Parser.new(source, opts).parse
+end
+
+
+ +
+ +
+
+ + pretty_generate(obj, opts = nil) + +
+ + +
+

Generate a JSON document from the Ruby data +structure obj and return it. The returned document is a prettier +form of the document returned by unparse.

+ +

The opts argument can be used to configure the generator. See the +generate method for a more detailed explanation.

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 262
+def pretty_generate(obj, opts = nil)
+  if State === opts
+    state, opts = opts, nil
+  else
+    state = PRETTY_STATE_PROTOTYPE.dup
+  end
+  if opts
+    if opts.respond_to? :to_hash
+      opts = opts.to_hash
+    elsif opts.respond_to? :to_h
+      opts = opts.to_h
+    else
+      raise TypeError, "can't convert #{opts.class} into Hash"
+    end
+    state.configure(opts)
+  end
+  state.generate(obj)
+end
+
+
+ +
+ +
+
+ + recurse_proc(result, &proc) + +
+ + +
+

Recursively calls passed Proc if the parsed data structure is an +Array or Hash

+
+ + + + + + +
+ + +
+
# File lib/json/common.rb, line 326
+def recurse_proc(result, &proc)
+  case result
+  when Array
+    result.each { |x| recurse_proc x, &proc }
+    proc.call result
+  when Hash
+    result.each { |x, y| recurse_proc x, &proc; recurse_proc y, &proc }
+    proc.call result
+  else
+    proc.call result
+  end
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/CircularDatastructure.html b/doc/classes/JSON/CircularDatastructure.html new file mode 100644 index 0000000..a57cddd --- /dev/null +++ b/doc/classes/JSON/CircularDatastructure.html @@ -0,0 +1,75 @@ + + + + + JSON::CircularDatastructure + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext.html b/doc/classes/JSON/Ext.html new file mode 100644 index 0000000..cda13e9 --- /dev/null +++ b/doc/classes/JSON/Ext.html @@ -0,0 +1,94 @@ + + + + + JSON::Ext + + + + + + + + + + + + + +
+
+ +
+ +

This module holds all the modules/classes that implement JSON’s +functionality as C extensions.

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator.html b/doc/classes/JSON/Ext/Generator.html new file mode 100644 index 0000000..cdff971 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator.html @@ -0,0 +1,96 @@ + + + + + JSON::Ext::Generator + + + + + + + + + + + + + +
+
+ +
+ +

This is the JSON generator implemented as a C +extension. It can be configured to be used by setting

+ +
JSON.generator = JSON::Ext::Generator
+ +

with the method generator= in JSON.

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods.html new file mode 100644 index 0000000..a228ad2 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods.html @@ -0,0 +1,125 @@ + + + + + JSON::Ext::Generator::GeneratorMethods + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/Array.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Array.html new file mode 100644 index 0000000..e98d4fe --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Array.html @@ -0,0 +1,127 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::Array + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(state = nil) + + +
+ + +
+

Returns a JSON string containing a JSON array, that is generated from this Array instance. state is a JSON::State +object, that can also be used to configure the produced JSON string output further.

+
+ + + + + + +
+ + +
+
static VALUE mArray_to_json(int argc, VALUE *argv, VALUE self) {
+    GENERATE_JSON(array);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html new file mode 100644 index 0000000..32860f5 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html @@ -0,0 +1,125 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::Bignum + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Returns a JSON string representation +for this Integer number.

+
+ + + + + + +
+ + +
+
static VALUE mBignum_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(bignum);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html new file mode 100644 index 0000000..331cde5 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html @@ -0,0 +1,125 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::FalseClass + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Returns a JSON string for false: +‘false’.

+
+ + + + + + +
+ + +
+
static VALUE mFalseClass_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(false);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html new file mode 100644 index 0000000..279cbb8 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html @@ -0,0 +1,125 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::Fixnum + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Returns a JSON string representation +for this Integer number.

+
+ + + + + + +
+ + +
+
static VALUE mFixnum_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(fixnum);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/Float.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Float.html new file mode 100644 index 0000000..95445d9 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Float.html @@ -0,0 +1,125 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::Float + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Returns a JSON string representation +for this Float number.

+
+ + + + + + +
+ + +
+
static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(float);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/Hash.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Hash.html new file mode 100644 index 0000000..a7384d9 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Hash.html @@ -0,0 +1,128 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::Hash + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(state = nil) + + +
+ + +
+

Returns a JSON string containing a JSON object, that is generated from this +Hash instance. state is a JSON::State +object, that can also be used to configure the produced JSON string output further.

+
+ + + + + + +
+ + +
+
static VALUE mHash_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(object);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html new file mode 100644 index 0000000..132aa3c --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html @@ -0,0 +1,124 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::NilClass + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Returns a JSON string for nil: ‘null’.

+
+ + + + + + +
+ + +
+
static VALUE mNilClass_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(null);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/Object.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Object.html new file mode 100644 index 0000000..a2d5565 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/Object.html @@ -0,0 +1,133 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::Object + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Converts this object to a string (calling to_s), converts it to a JSON string, and returns the result. This +is a fallback, if no special method #to_json was defined for some +object.

+
+ + + + + + +
+ + +
+
static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self)
+{
+    VALUE state;
+    VALUE string = rb_funcall(self, i_to_s, 0);
+    rb_scan_args(argc, argv, "01", &state);
+    Check_Type(string, T_STRING);
+    state = cState_from_state_s(cState, state);
+    return cState_partial_generate(state, string);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/String.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/String.html new file mode 100644 index 0000000..dbbb90b --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/String.html @@ -0,0 +1,281 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::String + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
I
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + String.included(modul) + + +
+ + +
+

Extends modul with the String::Extend module.

+
+ + + + + + +
+ + +
+
static VALUE mString_included_s(VALUE self, VALUE modul) {
+    VALUE result = rb_funcall(modul, i_extend, 1, mString_Extend);
+    return result;
+}
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

This string should be encoded with UTF-8 A call to this method returns a JSON string encoded with UTF16 big endian +characters as u????.

+
+ + + + + + +
+ + +
+
static VALUE mString_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(string);
+}
+
+
+ +
+ +
+
+ + to_json_raw(*args) + + +
+ + +
+

This method creates a JSON text from +the result of a call to #to_json_raw_object of +this String.

+
+ + + + + + +
+ + +
+
static VALUE mString_to_json_raw(int argc, VALUE *argv, VALUE self)
+{
+    VALUE obj = mString_to_json_raw_object(self);
+    Check_Type(obj, T_HASH);
+    return mHash_to_json(argc, argv, obj);
+}
+
+
+ +
+ +
+
+ + to_json_raw_object() + + +
+ + +
+

This method creates a raw object hash, that can be nested into other data +structures and will be generated as a raw string. This method should be +used, if you want to convert raw strings to JSON instead of UTF-8 strings, e. g. +binary data.

+
+ + + + + + +
+ + +
+
static VALUE mString_to_json_raw_object(VALUE self)
+{
+    VALUE ary;
+    VALUE result = rb_hash_new();
+    rb_hash_aset(result, rb_funcall(mJSON, i_create_id, 0), rb_class_name(rb_obj_class(self)));
+    ary = rb_funcall(self, i_unpack, 1, rb_str_new2("C*"));
+    rb_hash_aset(result, rb_str_new2("raw"), ary);
+    return result;
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html new file mode 100644 index 0000000..aea6758 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html @@ -0,0 +1,129 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::String::Extend + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
J
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + json_create(o) + + +
+ + +
+

Raw Strings are JSON Objects (the +raw bytes are stored in an array for the key “raw”). The Ruby String can be created by this module method.

+
+ + + + + + +
+ + +
+
static VALUE mString_Extend_json_create(VALUE self, VALUE o)
+{
+    VALUE ary;
+    Check_Type(o, T_HASH);
+    ary = rb_hash_aref(o, rb_str_new2("raw"));
+    return rb_funcall(ary, i_pack, 1, rb_str_new2("C*"));
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html b/doc/classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html new file mode 100644 index 0000000..d9ac60c --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html @@ -0,0 +1,124 @@ + + + + + JSON::Ext::Generator::GeneratorMethods::TrueClass + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + + +
+ + +
+

Returns a JSON string for true: ‘true’.

+
+ + + + + + +
+ + +
+
static VALUE mTrueClass_to_json(int argc, VALUE *argv, VALUE self)
+{
+    GENERATE_JSON(true);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Generator/State.html b/doc/classes/JSON/Ext/Generator/State.html new file mode 100644 index 0000000..bcef751 --- /dev/null +++ b/doc/classes/JSON/Ext/Generator/State.html @@ -0,0 +1,1684 @@ + + + + + JSON::Ext::Generator::State + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
#
+
+
    + + +
  • + [] +
  • + +
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
F
+
+ +
+ +
G
+
+ +
+ +
I
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
O
+
+ +
+ +
Q
+
+ +
+ +
S
+
+ +
+ +
T
+
+
    + + +
  • + to_h +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + from_state(opts) + + +
+ + +
+

Creates a State object from opts, which +ought to be Hash to create a new State instance +configured by opts, something else to create an unconfigured +instance. If opts is a State object, it +is just returned.

+
+ + + + + + +
+ + +
+
static VALUE cState_from_state_s(VALUE self, VALUE opts)
+{
+    if (rb_obj_is_kind_of(opts, self)) {
+        return opts;
+    } else if (rb_obj_is_kind_of(opts, rb_cHash)) {
+        return rb_funcall(self, i_new, 1, opts);
+    } else {
+        if (NIL_P(CJSON_SAFE_STATE_PROTOTYPE)) {
+            CJSON_SAFE_STATE_PROTOTYPE = rb_const_get(mJSON, i_SAFE_STATE_PROTOTYPE);
+        }
+        return rb_funcall(CJSON_SAFE_STATE_PROTOTYPE, i_dup, 0);
+    }
+}
+
+
+ +
+ +
+
+ + new(opts = {}) + + +
+ + +
+

Instantiates a new State object, configured by +opts.

+ +

opts can have the following keys:

+
  • +

    indent: a string used to indent levels (default: ”),

    +
  • +

    space: a string that is put after, a : or , delimiter +(default: ”),

    +
  • +

    #space_before: a +string that is put before a : pair delimiter (default: ”),

    +
  • +

    #object_nl: a +string that is put at the end of a JSON +object (default: ”),

    +
  • +

    #array_nl: a +string that is put at the end of a JSON +array (default: ”),

    +
  • +

    allow_nan: true if NaN, Infinity, and -Infinity should be +generated, otherwise an exception is thrown, if these values are +encountered. This options defaults to false.

    +
  • +

    #quirks_mode: Enables +#quirks_mode for parser, that +is for example generating single JSON +values instead of documents is possible.

    +
  • +

    #buffer_initial_length: +sets the initial length of the generator’s internal buffer.

    +
+
+ + + + + + +
+ + +
+
static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
+{
+    VALUE opts;
+    GET_STATE(self);
+    state->max_nesting = 19;
+    state->buffer_initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
+    rb_scan_args(argc, argv, "01", &opts);
+    if (!NIL_P(opts)) cState_configure(self, opts);
+    return self;
+}
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + [](name) + + +
+ + +
+

Return the value returned by method name.

+
+ + + + + + +
+ + +
+
static VALUE cState_aref(VALUE self, VALUE name)
+{
+    GET_STATE(self);
+    if (RTEST(rb_funcall(self, i_respond_to_p, 1, name))) {
+        return rb_funcall(self, i_send, 1, name);
+    } else {
+        return Qnil;
+    }
+}
+
+
+ +
+ +
+
+ + allow_nan? + + +
+ + +
+

Returns true, if NaN, Infinity, and -Infinity should be generated, +otherwise returns false.

+
+ + + + + + +
+ + +
+
static VALUE cState_allow_nan_p(VALUE self)
+{
+    GET_STATE(self);
+    return state->allow_nan ? Qtrue : Qfalse;
+}
+
+
+ +
+ +
+
+ + array_nl() + + +
+ + +
+

This string is put at the end of a line that holds a JSON array.

+
+ + + + + + +
+ + +
+
static VALUE cState_array_nl(VALUE self)
+{
+    GET_STATE(self);
+    return state->array_nl ? rb_str_new2(state->array_nl) : rb_str_new2("");
+}
+
+
+ +
+ +
+
+ + array_nl=(array_nl) + + +
+ + +
+

This string is put at the end of a line that holds a JSON array.

+
+ + + + + + +
+ + +
+
static VALUE cState_array_nl_set(VALUE self, VALUE array_nl)
+{
+    unsigned long len;
+    GET_STATE(self);
+    Check_Type(array_nl, T_STRING);
+    len = RSTRING_LEN(array_nl);
+    if (len == 0) {
+        if (state->array_nl) {
+            ruby_xfree(state->array_nl);
+            state->array_nl = NULL;
+        }
+    } else {
+        if (state->array_nl) ruby_xfree(state->array_nl);
+        state->array_nl = strdup(RSTRING_PTR(array_nl));
+        state->array_nl_len = len;
+    }
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + ascii_only? + + +
+ + +
+

Returns true, if NaN, Infinity, and -Infinity should be generated, +otherwise returns false.

+
+ + + + + + +
+ + +
+
static VALUE cState_ascii_only_p(VALUE self)
+{
+    GET_STATE(self);
+    return state->ascii_only ? Qtrue : Qfalse;
+}
+
+
+ +
+ +
+
+ + buffer_initial_length + + +
+ + +
+

This integer returns the current inital length of the buffer.

+
+ + + + + + +
+ + +
+
static VALUE cState_buffer_initial_length(VALUE self)
+{
+    GET_STATE(self);
+    return LONG2FIX(state->buffer_initial_length);
+}
+
+
+ +
+ +
+
+ + buffer_initial_length=(length) + + +
+ + +
+

This sets the initial length of the buffer to length, if +length > 0, otherwise its value isn’t changed.

+
+ + + + + + +
+ + +
+
static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_length)
+{
+    long initial_length;
+    GET_STATE(self);
+    Check_Type(buffer_initial_length, T_FIXNUM);
+    initial_length = FIX2LONG(buffer_initial_length);
+    if (initial_length > 0) {
+        state->buffer_initial_length = initial_length;
+    }
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + check_circular? + + +
+ + +
+

Returns true, if circular data structures should be checked, otherwise +returns false.

+
+ + + + + + +
+ + +
+
static VALUE cState_check_circular_p(VALUE self)
+{
+    GET_STATE(self);
+    return state->max_nesting ? Qtrue : Qfalse;
+}
+
+
+ +
+ +
+
+ + configure(opts) + + +
+ + +
+

Configure this State instance with the Hash +opts, and return itself.

+
+ + + +
+ Also aliased as: merge +
+ + + + +
+ + +
+
static VALUE cState_configure(VALUE self, VALUE opts)
+{
+    VALUE tmp;
+    GET_STATE(self);
+    tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
+    if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h");
+    if (NIL_P(tmp)) {
+        rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash");
+    }
+    opts = tmp;
+    tmp = rb_hash_aref(opts, ID2SYM(i_indent));
+    if (RTEST(tmp)) {
+        unsigned long len;
+        Check_Type(tmp, T_STRING);
+        len = RSTRING_LEN(tmp);
+        state->indent = fstrndup(RSTRING_PTR(tmp), len);
+        state->indent_len = len;
+    }
+    tmp = rb_hash_aref(opts, ID2SYM(i_space));
+    if (RTEST(tmp)) {
+        unsigned long len;
+        Check_Type(tmp, T_STRING);
+        len = RSTRING_LEN(tmp);
+        state->space = fstrndup(RSTRING_PTR(tmp), len);
+        state->space_len = len;
+    }
+    tmp = rb_hash_aref(opts, ID2SYM(i_space_before));
+    if (RTEST(tmp)) {
+        unsigned long len;
+        Check_Type(tmp, T_STRING);
+        len = RSTRING_LEN(tmp);
+        state->space_before = fstrndup(RSTRING_PTR(tmp), len);
+        state->space_before_len = len;
+    }
+    tmp = rb_hash_aref(opts, ID2SYM(i_array_nl));
+    if (RTEST(tmp)) {
+        unsigned long len;
+        Check_Type(tmp, T_STRING);
+        len = RSTRING_LEN(tmp);
+        state->array_nl = fstrndup(RSTRING_PTR(tmp), len);
+        state->array_nl_len = len;
+    }
+    tmp = rb_hash_aref(opts, ID2SYM(i_object_nl));
+    if (RTEST(tmp)) {
+        unsigned long len;
+        Check_Type(tmp, T_STRING);
+        len = RSTRING_LEN(tmp);
+        state->object_nl = fstrndup(RSTRING_PTR(tmp), len);
+        state->object_nl_len = len;
+    }
+    tmp = ID2SYM(i_max_nesting);
+    state->max_nesting = 19;
+    if (option_given_p(opts, tmp)) {
+        VALUE max_nesting = rb_hash_aref(opts, tmp);
+        if (RTEST(max_nesting)) {
+            Check_Type(max_nesting, T_FIXNUM);
+            state->max_nesting = FIX2LONG(max_nesting);
+        } else {
+            state->max_nesting = 0;
+        }
+    }
+    tmp = ID2SYM(i_depth);
+    state->depth = 0;
+    if (option_given_p(opts, tmp)) {
+        VALUE depth = rb_hash_aref(opts, tmp);
+        if (RTEST(depth)) {
+            Check_Type(depth, T_FIXNUM);
+            state->depth = FIX2LONG(depth);
+        } else {
+            state->depth = 0;
+        }
+    }
+    tmp = ID2SYM(i_buffer_initial_length);
+    if (option_given_p(opts, tmp)) {
+        VALUE buffer_initial_length = rb_hash_aref(opts, tmp);
+        if (RTEST(buffer_initial_length)) {
+            long initial_length;
+            Check_Type(buffer_initial_length, T_FIXNUM);
+            initial_length = FIX2LONG(buffer_initial_length);
+            if (initial_length > 0) state->buffer_initial_length = initial_length;
+        }
+    }
+    tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan));
+    state->allow_nan = RTEST(tmp);
+    tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only));
+    state->ascii_only = RTEST(tmp);
+    tmp = rb_hash_aref(opts, ID2SYM(i_quirks_mode));
+    state->quirks_mode = RTEST(tmp);
+    return self;
+}
+
+
+ +
+ +
+
+ + depth + + +
+ + +
+

This integer returns the current depth of data structure nesting.

+
+ + + + + + +
+ + +
+
static VALUE cState_depth(VALUE self)
+{
+    GET_STATE(self);
+    return LONG2FIX(state->depth);
+}
+
+
+ +
+ +
+
+ + depth=(depth) + + +
+ + +
+

This sets the maximum level of data structure nesting in the generated JSON to the integer depth, #max_nesting = 0 if no maximum +should be checked.

+
+ + + + + + +
+ + +
+
static VALUE cState_depth_set(VALUE self, VALUE depth)
+{
+    GET_STATE(self);
+    Check_Type(depth, T_FIXNUM);
+    state->depth = FIX2LONG(depth);
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + generate(obj) + + +
+ + +
+

Generates a valid JSON document from +object obj and returns the result. If no valid JSON document can be created this method +raises a GeneratorError exception.

+
+ + + + + + +
+ + +
+
static VALUE cState_generate(VALUE self, VALUE obj)
+{
+    VALUE result = cState_partial_generate(self, obj);
+    VALUE re, args[2];
+    GET_STATE(self);
+    if (!state->quirks_mode) {
+        args[0] = rb_str_new2("\\A\\s*(?:\\[.*\\]|\\{.*\\})\\s*\\Z");
+        args[1] = CRegexp_MULTILINE;
+        re = rb_class_new_instance(2, args, rb_cRegexp);
+        if (NIL_P(rb_funcall(re, i_match, 1, result))) {
+            rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed");
+        }
+    }
+    return result;
+}
+
+
+ +
+ +
+
+ + indent() + + +
+ + +
+

This string is used to indent levels in the JSON text.

+
+ + + + + + +
+ + +
+
static VALUE cState_indent(VALUE self)
+{
+    GET_STATE(self);
+    return state->indent ? rb_str_new2(state->indent) : rb_str_new2("");
+}
+
+
+ +
+ +
+
+ + indent=(indent) + + +
+ + +
+

This string is used to indent levels in the JSON text.

+
+ + + + + + +
+ + +
+
static VALUE cState_indent_set(VALUE self, VALUE indent)
+{
+    unsigned long len;
+    GET_STATE(self);
+    Check_Type(indent, T_STRING);
+    len = RSTRING_LEN(indent);
+    if (len == 0) {
+        if (state->indent) {
+            ruby_xfree(state->indent);
+            state->indent = NULL;
+            state->indent_len = 0;
+        }
+    } else {
+        if (state->indent) ruby_xfree(state->indent);
+        state->indent = strdup(RSTRING_PTR(indent));
+        state->indent_len = len;
+    }
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + initialize_copy(orig) + + +
+ + +
+

Initializes this object from orig if it to be duplicated/cloned and returns +it.

+
+ + + + + + +
+ + +
+
static VALUE cState_init_copy(VALUE obj, VALUE orig)
+{
+    JSON_Generator_State *objState, *origState;
+
+    Data_Get_Struct(obj, JSON_Generator_State, objState);
+    Data_Get_Struct(orig, JSON_Generator_State, origState);
+    if (!objState) rb_raise(rb_eArgError, "unallocated JSON::State");
+
+    MEMCPY(objState, origState, JSON_Generator_State, 1);
+    objState->indent = fstrndup(origState->indent, origState->indent_len);
+    objState->space = fstrndup(origState->space, origState->space_len);
+    objState->space_before = fstrndup(origState->space_before, origState->space_before_len);
+    objState->object_nl = fstrndup(origState->object_nl, origState->object_nl_len);
+    objState->array_nl = fstrndup(origState->array_nl, origState->array_nl_len);
+    if (origState->array_delim) objState->array_delim = fbuffer_dup(origState->array_delim);
+    if (origState->object_delim) objState->object_delim = fbuffer_dup(origState->object_delim);
+    if (origState->object_delim2) objState->object_delim2 = fbuffer_dup(origState->object_delim2);
+    return obj;
+}
+
+
+ +
+ +
+
+ + max_nesting + + +
+ + +
+

This integer returns the maximum level of data structure nesting in the +generated JSON, #max_nesting = 0 if no maximum +is checked.

+
+ + + + + + +
+ + +
+
static VALUE cState_max_nesting(VALUE self)
+{
+    GET_STATE(self);
+    return LONG2FIX(state->max_nesting);
+}
+
+
+ +
+ +
+
+ + max_nesting=(depth) + + +
+ + +
+

This sets the maximum level of data structure nesting in the generated JSON to the integer depth, #max_nesting = 0 if no maximum +should be checked.

+
+ + + + + + +
+ + +
+
static VALUE cState_max_nesting_set(VALUE self, VALUE depth)
+{
+    GET_STATE(self);
+    Check_Type(depth, T_FIXNUM);
+    return state->max_nesting = FIX2LONG(depth);
+}
+
+
+ +
+ +
+
+ + merge(p1) + +
+ + +
+ +
+ + + + + +
+ +
+
+ + object_nl() + + +
+ + +
+

This string is put at the end of a line that holds a JSON object (or Hash).

+
+ + + + + + +
+ + +
+
static VALUE cState_object_nl(VALUE self)
+{
+    GET_STATE(self);
+    return state->object_nl ? rb_str_new2(state->object_nl) : rb_str_new2("");
+}
+
+
+ +
+ +
+
+ + object_nl=(object_nl) + + +
+ + +
+

This string is put at the end of a line that holds a JSON object (or Hash).

+
+ + + + + + +
+ + +
+
static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
+{
+    unsigned long len;
+    GET_STATE(self);
+    Check_Type(object_nl, T_STRING);
+    len = RSTRING_LEN(object_nl);
+    if (len == 0) {
+        if (state->object_nl) {
+            ruby_xfree(state->object_nl);
+            state->object_nl = NULL;
+        }
+    } else {
+        if (state->object_nl) ruby_xfree(state->object_nl);
+        state->object_nl = strdup(RSTRING_PTR(object_nl));
+        state->object_nl_len = len;
+    }
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + quirks_mode? + + +
+ + +
+

Returns true, if quirks mode is enabled. Otherwise returns false.

+
+ + + + + + +
+ + +
+
static VALUE cState_quirks_mode_p(VALUE self)
+{
+    GET_STATE(self);
+    return state->quirks_mode ? Qtrue : Qfalse;
+}
+
+
+ +
+ +
+
+ + quirks_mode=(enable) + + +
+ + +
+

If set to true, enables the #quirks_mode mode.

+
+ + + + + + +
+ + +
+
static VALUE cState_quirks_mode_set(VALUE self, VALUE enable)
+{
+    GET_STATE(self);
+    state->quirks_mode = RTEST(enable);
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + quirks_mode? + + +
+ + +
+

Returns true, if quirks mode is enabled. Otherwise returns false.

+
+ + + + + + +
+ + +
+
static VALUE cState_quirks_mode_p(VALUE self)
+{
+    GET_STATE(self);
+    return state->quirks_mode ? Qtrue : Qfalse;
+}
+
+
+ +
+ +
+
+ + space() + + +
+ + +
+

This string is used to insert a space between the tokens in a JSON string.

+
+ + + + + + +
+ + +
+
static VALUE cState_space(VALUE self)
+{
+    GET_STATE(self);
+    return state->space ? rb_str_new2(state->space) : rb_str_new2("");
+}
+
+
+ +
+ +
+
+ + space=(space) + + +
+ + +
+

This string is used to insert a space between the tokens in a JSON string.

+
+ + + + + + +
+ + +
+
static VALUE cState_space_set(VALUE self, VALUE space)
+{
+    unsigned long len;
+    GET_STATE(self);
+    Check_Type(space, T_STRING);
+    len = RSTRING_LEN(space);
+    if (len == 0) {
+        if (state->space) {
+            ruby_xfree(state->space);
+            state->space = NULL;
+            state->space_len = 0;
+        }
+    } else {
+        if (state->space) ruby_xfree(state->space);
+        state->space = strdup(RSTRING_PTR(space));
+        state->space_len = len;
+    }
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + space_before() + + +
+ + +
+

This string is used to insert a space before the ‘:’ in JSON objects.

+
+ + + + + + +
+ + +
+
static VALUE cState_space_before(VALUE self)
+{
+    GET_STATE(self);
+    return state->space_before ? rb_str_new2(state->space_before) : rb_str_new2("");
+}
+
+
+ +
+ +
+
+ + space_before=(space_before) + + +
+ + +
+

This string is used to insert a space before the ‘:’ in JSON objects.

+
+ + + + + + +
+ + +
+
static VALUE cState_space_before_set(VALUE self, VALUE space_before)
+{
+    unsigned long len;
+    GET_STATE(self);
+    Check_Type(space_before, T_STRING);
+    len = RSTRING_LEN(space_before);
+    if (len == 0) {
+        if (state->space_before) {
+            ruby_xfree(state->space_before);
+            state->space_before = NULL;
+            state->space_before_len = 0;
+        }
+    } else {
+        if (state->space_before) ruby_xfree(state->space_before);
+        state->space_before = strdup(RSTRING_PTR(space_before));
+        state->space_before_len = len;
+    }
+    return Qnil;
+}
+
+
+ +
+ +
+
+ + to_h + + +
+ + +
+

Returns the configuration instance variables as a hash, that can be passed +to the configure method.

+
+ + + + + + +
+ + +
+
static VALUE cState_to_h(VALUE self)
+{
+    VALUE result = rb_hash_new();
+    GET_STATE(self);
+    rb_hash_aset(result, ID2SYM(i_indent), rb_str_new(state->indent, state->indent_len));
+    rb_hash_aset(result, ID2SYM(i_space), rb_str_new(state->space, state->space_len));
+    rb_hash_aset(result, ID2SYM(i_space_before), rb_str_new(state->space_before, state->space_before_len));
+    rb_hash_aset(result, ID2SYM(i_object_nl), rb_str_new(state->object_nl, state->object_nl_len));
+    rb_hash_aset(result, ID2SYM(i_array_nl), rb_str_new(state->array_nl, state->array_nl_len));
+    rb_hash_aset(result, ID2SYM(i_allow_nan), state->allow_nan ? Qtrue : Qfalse);
+    rb_hash_aset(result, ID2SYM(i_ascii_only), state->ascii_only ? Qtrue : Qfalse);
+    rb_hash_aset(result, ID2SYM(i_quirks_mode), state->quirks_mode ? Qtrue : Qfalse);
+    rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting));
+    rb_hash_aset(result, ID2SYM(i_depth), LONG2FIX(state->depth));
+    rb_hash_aset(result, ID2SYM(i_buffer_initial_length), LONG2FIX(state->buffer_initial_length));
+    return result;
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Ext/Parser.html b/doc/classes/JSON/Ext/Parser.html new file mode 100644 index 0000000..3a5d41b --- /dev/null +++ b/doc/classes/JSON/Ext/Parser.html @@ -0,0 +1,415 @@ + + + + + JSON::Ext::Parser + + + + + + + + + + + + + +
+
+ +
+ +

This is the JSON parser implemented as a C +extension. It can be configured to be used by setting

+ +
JSON.parser = JSON::Ext::Parser
+ +

with the method parser= in JSON.

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
Q
+
+ +
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + new(source, opts => {}) + + +
+ + +
+

Creates a new JSON::Ext::Parser instance for the +string source.

+ +

Creates a new JSON::Ext::Parser instance for the +string source.

+ +

It will be configured by the opts hash. opts can have the +following keys:

+ +

opts can have the following keys:

+
  • +

    max_nesting: The maximum depth of nesting allowed in the +parsed data structures. Disable depth checking with :max_nesting => +false|nil|0, it defaults to 19.

    +
  • +

    allow_nan: If set to true, allow NaN, Infinity and +-Infinity in defiance of RFC 4627 to be parsed by the Parser. This option defaults to false.

    +
  • +

    symbolize_names: If set to true, returns symbols for the +names (keys) in a JSON object. Otherwise +strings are returned, which is also the default.

    +
  • +

    create_additions: If set to false, the Parser doesn’t create additions even if a matchin +class and create_id was found. This option defaults to true.

    +
  • +

    object_class: Defaults to Hash

    +
  • +

    array_class: Defaults to Array

    +
+
+ + + + + + +
+ + +
+
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
+{
+    VALUE source, opts;
+    GET_PARSER_INIT;
+
+    if (json->Vsource) {
+        rb_raise(rb_eTypeError, "already initialized instance");
+    }
+    rb_scan_args(argc, argv, "11", &source, &opts);
+    if (!NIL_P(opts)) {
+        opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
+        if (NIL_P(opts)) {
+            rb_raise(rb_eArgError, "opts needs to be like a hash");
+        } else {
+            VALUE tmp = ID2SYM(i_max_nesting);
+            if (option_given_p(opts, tmp)) {
+                VALUE max_nesting = rb_hash_aref(opts, tmp);
+                if (RTEST(max_nesting)) {
+                    Check_Type(max_nesting, T_FIXNUM);
+                    json->max_nesting = FIX2INT(max_nesting);
+                } else {
+                    json->max_nesting = 0;
+                }
+            } else {
+                json->max_nesting = 19;
+            }
+            tmp = ID2SYM(i_allow_nan);
+            if (option_given_p(opts, tmp)) {
+                json->allow_nan = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0;
+            } else {
+                json->allow_nan = 0;
+            }
+            tmp = ID2SYM(i_symbolize_names);
+            if (option_given_p(opts, tmp)) {
+                json->symbolize_names = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0;
+            } else {
+                json->symbolize_names = 0;
+            }
+            tmp = ID2SYM(i_quirks_mode);
+            if (option_given_p(opts, tmp)) {
+                VALUE quirks_mode = rb_hash_aref(opts, tmp);
+                json->quirks_mode = RTEST(quirks_mode) ? 1 : 0;
+            } else {
+                json->quirks_mode = 0;
+            }
+            tmp = ID2SYM(i_create_additions);
+            if (option_given_p(opts, tmp)) {
+                json->create_additions = RTEST(rb_hash_aref(opts, tmp));
+            } else {
+                json->create_additions = 1;
+            }
+            tmp = ID2SYM(i_create_id);
+            if (option_given_p(opts, tmp)) {
+                json->create_id = rb_hash_aref(opts, tmp);
+            } else {
+                json->create_id = rb_funcall(mJSON, i_create_id, 0);
+            }
+            tmp = ID2SYM(i_object_class);
+            if (option_given_p(opts, tmp)) {
+                json->object_class = rb_hash_aref(opts, tmp);
+            } else {
+                json->object_class = Qnil;
+            }
+            tmp = ID2SYM(i_array_class);
+            if (option_given_p(opts, tmp)) {
+                json->array_class = rb_hash_aref(opts, tmp);
+            } else {
+                json->array_class = Qnil;
+            }
+            tmp = ID2SYM(i_match_string);
+            if (option_given_p(opts, tmp)) {
+                VALUE match_string = rb_hash_aref(opts, tmp);
+                json->match_string = RTEST(match_string) ? match_string : Qnil;
+            } else {
+                json->match_string = Qnil;
+            }
+        }
+    } else {
+        json->max_nesting = 19;
+        json->allow_nan = 0;
+        json->create_additions = 1;
+        json->create_id = rb_funcall(mJSON, i_create_id, 0);
+        json->object_class = Qnil;
+        json->array_class = Qnil;
+    }
+    source = rb_convert_type(source, T_STRING, "String", "to_str");
+    if (!json->quirks_mode) {
+      source = convert_encoding(StringValue(source));
+    }
+    json->current_nesting = 0;
+    json->len = RSTRING_LEN(source);
+    json->source = RSTRING_PTR(source);;
+    json->Vsource = source;
+    return self;
+}
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + parse() + + +
+ + +
+

Parses the current JSON text source +and returns the complete data structure as a result.

+
+ + + + + + +
+ + +
+
static VALUE cParser_parse(VALUE self)
+{
+  GET_PARSER;
+
+  if (json->quirks_mode) {
+    return cParser_parse_quirks_mode(self);
+  } else {
+    return cParser_parse_strict(self);
+  }
+}
+
+
+ +
+ +
+
+ + quirks_mode?() + + +
+ + +
+

Returns a true, if this parser is in quirks_mode, false otherwise.

+
+ + + + + + +
+ + +
+
static VALUE cParser_quirks_mode_p(VALUE self)
+{
+    GET_PARSER;
+    return json->quirks_mode ? Qtrue : Qfalse;
+}
+
+
+ +
+ +
+
+ + source() + + +
+ + +
+

Returns a copy of the current source string, that was used to +construct this Parser.

+
+ + + + + + +
+ + +
+
static VALUE cParser_source(VALUE self)
+{
+    GET_PARSER;
+    return rb_str_dup(json->Vsource);
+}
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/GeneratorError.html b/doc/classes/JSON/GeneratorError.html new file mode 100644 index 0000000..b609f3b --- /dev/null +++ b/doc/classes/JSON/GeneratorError.html @@ -0,0 +1,81 @@ + + + + + JSON::UnparserError + + + + + + + + + + + + + +
+
+ +
+ +

This exception is raised if a generator or unparser error occurs.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/JSONError.html b/doc/classes/JSON/JSONError.html new file mode 100644 index 0000000..bebf9af --- /dev/null +++ b/doc/classes/JSON/JSONError.html @@ -0,0 +1,81 @@ + + + + + JSON::JSONError + + + + + + + + + + + + + +
+
+ +
+ +

The base exception for JSON errors.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/MissingUnicodeSupport.html b/doc/classes/JSON/MissingUnicodeSupport.html new file mode 100644 index 0000000..1928834 --- /dev/null +++ b/doc/classes/JSON/MissingUnicodeSupport.html @@ -0,0 +1,82 @@ + + + + + JSON::MissingUnicodeSupport + + + + + + + + + + + + + +
+
+ +
+ +

This exception is raised if the required unicode support is missing on the +system. Usually this means that the iconv library is not installed.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/NestingError.html b/doc/classes/JSON/NestingError.html new file mode 100644 index 0000000..65d9674 --- /dev/null +++ b/doc/classes/JSON/NestingError.html @@ -0,0 +1,82 @@ + + + + + JSON::NestingError + + + + + + + + + + + + + +
+
+ +
+ +

This exception is raised if the nesting of parsed data structures is too +deep.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/ParserError.html b/doc/classes/JSON/ParserError.html new file mode 100644 index 0000000..7e05149 --- /dev/null +++ b/doc/classes/JSON/ParserError.html @@ -0,0 +1,81 @@ + + + + + JSON::ParserError + + + + + + + + + + + + + +
+
+ +
+ +

This exception is raised if a parser error occurs.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure.html b/doc/classes/JSON/Pure.html new file mode 100644 index 0000000..6770d01 --- /dev/null +++ b/doc/classes/JSON/Pure.html @@ -0,0 +1,96 @@ + + + + + JSON::Pure + + + + + + + + + + + + + +
+
+ +
+ +

This module holds all the modules/classes that implement JSON’s +functionality in pure ruby.

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator.html b/doc/classes/JSON/Pure/Generator.html new file mode 100644 index 0000000..b5d373b --- /dev/null +++ b/doc/classes/JSON/Pure/Generator.html @@ -0,0 +1,85 @@ + + + + + JSON::Pure::Generator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods.html new file mode 100644 index 0000000..2e09ad8 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods.html @@ -0,0 +1,120 @@ + + + + + JSON::Pure::Generator::GeneratorMethods + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/Array.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Array.html new file mode 100644 index 0000000..f1f9336 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Array.html @@ -0,0 +1,129 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::Array + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(state = nil, *) + +
+ + +
+

Returns a JSON string containing a JSON array, that is unparsed from this Array instance. state is a JSON::State +object, that can also be used to configure the produced JSON string output further.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 328
+def to_json(state = nil, *)
+  state = State.from_state(state)
+  state.check_max_nesting
+  json_transform(state)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html new file mode 100644 index 0000000..5363e97 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html @@ -0,0 +1,122 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::FalseClass + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + +
+ + +
+

Returns a JSON string for false: +‘false’.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 458
+def to_json(*) 'false' end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/Float.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Float.html new file mode 100644 index 0000000..34b061f --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Float.html @@ -0,0 +1,140 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::Float + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(state = nil, *) + +
+ + +
+

Returns a JSON string representation +for this Float number.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 364
+def to_json(state = nil, *)
+  state = State.from_state(state)
+  case
+  when infinite?
+    if state.allow_nan?
+      to_s
+    else
+      raise GeneratorError, "#{self} not allowed in JSON"
+    end
+  when nan?
+    if state.allow_nan?
+      to_s
+    else
+      raise GeneratorError, "#{self} not allowed in JSON"
+    end
+  else
+    to_s
+  end
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/Hash.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Hash.html new file mode 100644 index 0000000..6d89a73 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Hash.html @@ -0,0 +1,130 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::Hash + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(state = nil, *) + +
+ + +
+

Returns a JSON string containing a JSON object, that is unparsed from this Hash instance. state is a JSON::State object, +that can also be used to configure the produced JSON string output further. depth +is used to find out nesting depth, to indent accordingly.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 284
+def to_json(state = nil, *)
+  state = State.from_state(state)
+  state.check_max_nesting
+  json_transform(state)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/Integer.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Integer.html new file mode 100644 index 0000000..1de3b7b --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Integer.html @@ -0,0 +1,122 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::Integer + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + +
+ + +
+

Returns a JSON string representation +for this Integer number.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 359
+def to_json(*) to_s end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html new file mode 100644 index 0000000..aa4e755 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html @@ -0,0 +1,121 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::NilClass + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + +
+ + +
+

Returns a JSON string for nil: ‘null’.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 463
+def to_json(*) 'null' end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/Object.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Object.html new file mode 100644 index 0000000..a423970 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/Object.html @@ -0,0 +1,125 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::Object + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + +
+ + +
+

Converts this object to a string (calling to_s), converts it to a JSON string, and returns the result. This +is a fallback, if no special method #to_json was defined for some +object.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 275
+def to_json(*) to_s.to_json end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/String.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/String.html new file mode 100644 index 0000000..b282713 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/String.html @@ -0,0 +1,283 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::String + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
I
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + included(modul) + +
+ + +
+

Extends modul with the String::Extend module.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 429
+def self.included(modul)
+  modul.extend Extend
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + to_json(state = nil, *args) + +
+ + +
+

This string should be encoded with UTF-8 A call to this method returns a JSON string encoded with UTF16 big endian +characters as u????.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 390
+def to_json(state = nil, *args)
+  state = State.from_state(state)
+  if encoding == ::Encoding::UTF_8
+    string = self
+  else
+    string = encode(::Encoding::UTF_8)
+  end
+  if state.ascii_only?
+    '"' << JSON.utf8_to_json_ascii(string) << '"'
+  else
+    '"' << JSON.utf8_to_json(string) << '"'
+  end
+end
+
+
+ +
+ +
+
+ + to_json_raw(*args) + +
+ + +
+

This method creates a JSON text from +the result of a call to #to_json_raw_object of +this String.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 446
+def to_json_raw(*args)
+  to_json_raw_object.to_json(*args)
+end
+
+
+ +
+ +
+
+ + to_json_raw_object() + +
+ + +
+

This method creates a raw object hash, that can be nested into other data +structures and will be unparsed as a raw string. This method should be +used, if you want to convert raw strings to JSON instead of UTF-8 strings, e. g. +binary data.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 437
+def to_json_raw_object
+  {
+    JSON.create_id  => self.class.name,
+    'raw'           => self.unpack('C*'),
+  }
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html new file mode 100644 index 0000000..c9a6da0 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html @@ -0,0 +1,132 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::String::Extend + + + + + + + + + + + + + +
+
+ +
+ +

Module that holds the extinding methods if, the String module is included.

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
J
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + json_create(o) + +
+ + +
+

Raw Strings are JSON Objects (the +raw bytes are stored in an array for the key “raw”). The Ruby String can be created by this module method.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 423
+def json_create(o)
+  o['raw'].pack('C*')
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html b/doc/classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html new file mode 100644 index 0000000..320c144 --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html @@ -0,0 +1,121 @@ + + + + + JSON::Pure::Generator::GeneratorMethods::TrueClass + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + to_json(*) + +
+ + +
+

Returns a JSON string for true: ‘true’.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 453
+def to_json(*) 'true' end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Generator/State.html b/doc/classes/JSON/Pure/Generator/State.html new file mode 100644 index 0000000..984046c --- /dev/null +++ b/doc/classes/JSON/Pure/Generator/State.html @@ -0,0 +1,748 @@ + + + + + JSON::Pure::Generator::State + + + + + + + + + + + + + +
+
+ +
+ +

This class is used to create State instances, that +are use to hold data while generating a JSON text from a Ruby data structure.

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
#
+
+
    + + +
  • + [] +
  • + +
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
G
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
Q
+
+ +
+ +
T
+
+
    + + +
  • + to_h +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ [RW] + array_nl

This string is put at the end of a line that holds a JSON array.

+ [RW] + depth

This integer returns the current depth data structure nesting in the +generated JSON.

+ [RW] + indent

This string is used to indent levels in the JSON text.

+ [RW] + max_nesting

This integer returns the maximum level of data structure nesting in the +generated JSON, #max_nesting = 0 if no +maximum is checked.

+ [RW] + object_nl

This string is put at the end of a line that holds a JSON object (or Hash).

+ [RW] + quirks_mode

If this attribute is set to true, quirks mode is enabled, otherwise it’s +disabled.

+ [RW] + space

This string is used to insert a space between the tokens in a JSON string.

+ [RW] + space_before

This string is used to insert a space before the ‘:’ in JSON objects.

+ + + + + +
Class Public methods
+ +
+
+ + from_state(opts) + +
+ + +
+

Creates a State object from opts, which +ought to be Hash to create a new State instance +configured by opts, something else to create an unconfigured +instance. If opts is a State object, it +is just returned.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 108
+def self.from_state(opts)
+  case
+  when self === opts
+    opts
+  when opts.respond_to?(:to_hash)
+    new(opts.to_hash)
+  when opts.respond_to?(:to_h)
+    new(opts.to_h)
+  else
+    SAFE_STATE_PROTOTYPE.dup
+  end
+end
+
+
+ +
+ +
+
+ + new(opts = {}) + +
+ + +
+

Instantiates a new State object, configured by +opts.

+ +

opts can have the following keys:

+
  • +

    indent: a string used to indent levels (default: ”),

    +
  • +

    space: a string that is put after, a : or , delimiter +(default: ”),

    +
  • +

    #space_before: a +string that is put before a : pair delimiter (default: ”),

    +
  • +

    #object_nl: +a string that is put at the end of a JSON +object (default: ”),

    +
  • +

    #array_nl: a +string that is put at the end of a JSON +array (default: ”),

    +
  • +

    check_circular: is deprecated now, use the :#max_nesting option instead,

    +
  • +

    #max_nesting: sets +the maximum level of data structure nesting in the generated JSON, #max_nesting = 0 if no +maximum should be checked.

    +
  • +

    allow_nan: true if NaN, Infinity, and -Infinity should be +generated, otherwise an exception is thrown, if these values are +encountered. This options defaults to false.

    +
  • +

    #quirks_mode: +Enables #quirks_mode for +parser, that is for example generating single JSON values instead of documents is possible.

    +
+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 138
+def initialize(opts = {})
+  @indent                = ''
+  @space                 = ''
+  @space_before          = ''
+  @object_nl             = ''
+  @array_nl              = ''
+  @allow_nan             = false
+  @ascii_only            = false
+  @quirks_mode           = false
+  @buffer_initial_length = 1024
+  configure opts
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + [](name) + +
+ + +
+

Return the value returned by method name.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 265
+def [](name)
+  __send__ name
+end
+
+
+ +
+ +
+
+ + allow_nan?() + +
+ + +
+

Returns true if NaN, Infinity, and -Infinity should be considered as valid +JSON and output.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 205
+def allow_nan?
+  @allow_nan
+end
+
+
+ +
+ +
+
+ + ascii_only?() + +
+ + +
+

Returns true, if only ASCII characters should be generated. Otherwise +returns false.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 211
+def ascii_only?
+  @ascii_only
+end
+
+
+ +
+ +
+
+ + check_circular?() + +
+ + +
+

Returns true, if circular data structures are checked, otherwise returns +false.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 199
+def check_circular?
+  !@max_nesting.zero?
+end
+
+
+ +
+ +
+
+ + configure(opts) + +
+ + +
+

Configure this State instance with the Hash +opts, and return itself.

+
+ + + +
+ Also aliased as: merge +
+ + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 222
+def configure(opts)
+  @indent         = opts[:indent] if opts.key?(:indent)
+  @space          = opts[:space] if opts.key?(:space)
+  @space_before   = opts[:space_before] if opts.key?(:space_before)
+  @object_nl      = opts[:object_nl] if opts.key?(:object_nl)
+  @array_nl       = opts[:array_nl] if opts.key?(:array_nl)
+  @allow_nan      = !!opts[:allow_nan] if opts.key?(:allow_nan)
+  @ascii_only     = opts[:ascii_only] if opts.key?(:ascii_only)
+  @depth          = opts[:depth] || 0
+  @quirks_mode    = opts[:quirks_mode] if opts.key?(:quirks_mode)
+  if !opts.key?(:max_nesting) # defaults to 19
+    @max_nesting = 19
+  elsif opts[:max_nesting]
+    @max_nesting = opts[:max_nesting]
+  else
+    @max_nesting = 0
+  end
+  self
+end
+
+
+ +
+ +
+
+ + generate(obj) + +
+ + +
+

Generates a valid JSON document from +object obj and returns the result. If no valid JSON document can be created this method +raises a GeneratorError exception.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 256
+def generate(obj)
+  result = obj.to_json(self)
+  if !@quirks_mode && result !~ /\A\s*(?:\[.*\]|\{.*\})\s*\Z/
+    raise GeneratorError, "only generation of JSON objects or arrays allowed"
+  end
+  result
+end
+
+
+ +
+ +
+
+ + merge(opts) + +
+ + +
+ +
+ + + + + +
+ +
+
+ + quirks_mode?() + +
+ + +
+

Returns true, if quirks mode is enabled. Otherwise returns false.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 216
+def quirks_mode?
+  @quirks_mode
+end
+
+
+ +
+ +
+
+ + to_h() + +
+ + +
+

Returns the configuration instance variables as a hash, that can be passed +to the configure method.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/generator.rb, line 245
+def to_h
+  result = {}
+  for iv in ]indent space space_before object_nl array_nl allow_nan max_nesting ascii_only quirks_mode buffer_initial_length depth]
+    result[iv.intern] = instance_variable_get("@#{iv}")
+  end
+  result
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/JSON/Pure/Parser.html b/doc/classes/JSON/Pure/Parser.html new file mode 100644 index 0000000..f212825 --- /dev/null +++ b/doc/classes/JSON/Pure/Parser.html @@ -0,0 +1,620 @@ + + + + + JSON::Pure::Parser + + + + + + + + + + + + + +
+
+ +
+ +

This class implements the JSON parser that is +used to parse a JSON string into a Ruby data +structure.

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
Q
+
+ +
+ +
R
+
+ +
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
STRING=/" ((?:[^\x0-\x1f"\\] | +# escaped special characters: +\\["\\\/bfnrt] | +\\u[0-9a-fA-F]{4} | +# match all but escaped special characters: +\\[\x20-\x21\x23-\x2e\x30-\x5b\x5d-\x61\x63-\x65\x67-\x6d\x6f-\x71\x73\x75-\xff])*) +"/nx
 
INTEGER=/(-?0|-?[1-9]\d*)/
 
FLOAT=/(-? +(?:0|[1-9]\d*) +(?: +\.\d+(?i:e[+-]?\d+) | +\.\d+ | +(?i:e[+-]?\d+) +) +)/x
 
NAN=/NaN/
 
INFINITY=/Infinity/
 
MINUS_INFINITY=/-Infinity/
 
OBJECT_OPEN=/\{/
 
OBJECT_CLOSE=/\}/
 
ARRAY_OPEN=/\[/
 
ARRAY_CLOSE=/\]/
 
PAIR_DELIMITER=/:/
 
COLLECTION_DELIMITER=/,/
 
TRUE=/true/
 
FALSE=/false/
 
NULL=/null/
 
IGNORE=%r( +(?: +//[^\n\r]*[\n\r]| # line comments +/\* # c-style comments +(?: +[^*/]| # normal chars +/[^*]| # slashes that do not start a nested comment +\*[^/]| # asterisks that do not end this comment +/(?=\*/) # single slash before this comment's end +)* +\*/ # the End of this comment +|[ \t\r\n]+ # whitespaces: space, horicontal tab, lf, cr +)+ +)mx
 
UNPARSED=Object.new
 
UNESCAPE_MAP=Hash.new { |h, k| h[k] = k.chr }
 

Unescape characters in strings.

EMPTY_8BIT_STRING=''
 
+ + + + + + + + +
Class Public methods
+ +
+
+ + new(source, opts = {}) + +
+ + +
+

Creates a new JSON::Pure::Parser instance for the +string source.

+ +

It will be configured by the opts hash. opts can have the +following keys:

+
  • +

    max_nesting: The maximum depth of nesting allowed in the +parsed data structures. Disable depth checking with :max_nesting => +false|nil|0, it defaults to 19.

    +
  • +

    allow_nan: If set to true, allow NaN, Infinity and +-Infinity in defiance of RFC 4627 to be parsed by the Parser. This option defaults to false.

    +
  • +

    symbolize_names: If set to true, returns symbols for the +names (keys) in a JSON object. Otherwise +strings are returned, which is also the default.

    +
  • +

    create_additions: If set to false, the Parser doesn’t create additions even if a matchin +class and create_id was found. This option defaults to true.

    +
  • +

    object_class: Defaults to Hash

    +
  • +

    array_class: Defaults to Array

    +
  • +

    quirks_mode: Enables quirks_mode for parser, that is for +example parsing single JSON values instead of +documents is possible.

    +
+
+ + + + + + +
+ + +
+
# File lib/json/pure/parser.rb, line 73
+def initialize(source, opts = {})
+  opts ||= {}
+  unless @quirks_mode = opts[:quirks_mode]
+    source = convert_encoding source
+  end
+  super source
+  if !opts.key?(:max_nesting) # defaults to 19
+    @max_nesting = 19
+  elsif opts[:max_nesting]
+    @max_nesting = opts[:max_nesting]
+  else
+    @max_nesting = 0
+  end
+  @allow_nan = !!opts[:allow_nan]
+  @symbolize_names = !!opts[:symbolize_names]
+  if opts.key?(:create_additions)
+    @create_additions = !!opts[:create_additions]
+  else
+    @create_additions = true
+  end
+  @create_id = @create_additions ? JSON.create_id : nil
+  @object_class = opts[:object_class] || Hash
+  @array_class  = opts[:array_class] || Array
+  @match_string = opts[:match_string]
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + parse() + +
+ + +
+

Parses the current JSON string +source and returns the complete data structure as a result.

+
+ + + + + + +
+ + +
+
# File lib/json/pure/parser.rb, line 112
+def parse
+  reset
+  obj = nil
+  if @quirks_mode
+    while !eos? && skip(IGNORE)
+    end
+    if eos?
+      raise ParserError, "source did not contain any JSON!"
+    else
+      obj = parse_value
+      obj == UNPARSED and raise ParserError, "source did not contain any JSON!"
+    end
+  else
+    until eos?
+      case
+      when scan(OBJECT_OPEN)
+        obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
+        @current_nesting = 1
+        obj = parse_object
+      when scan(ARRAY_OPEN)
+        obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
+        @current_nesting = 1
+        obj = parse_array
+      when skip(IGNORE)
+        ;
+      else
+        raise ParserError, "source '#{peek(20)}' not in JSON!"
+      end
+    end
+    obj or raise ParserError, "source did not contain any JSON!"
+  end
+  obj
+end
+
+
+ +
+ +
+
+ + quirks_mode?() + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/pure/parser.rb, line 101
+def quirks_mode?
+  !!@quirks_mode
+end
+
+
+ +
+ +
+
+ + reset() + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/pure/parser.rb, line 105
+def reset
+  super
+  @current_nesting = 0
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Kernel.html b/doc/classes/Kernel.html new file mode 100644 index 0000000..53482e9 --- /dev/null +++ b/doc/classes/Kernel.html @@ -0,0 +1,69 @@ + + + + + Kernel + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/classes/OpenStruct.html b/doc/classes/OpenStruct.html new file mode 100644 index 0000000..eaf757a --- /dev/null +++ b/doc/classes/OpenStruct.html @@ -0,0 +1,238 @@ + + + + + OpenStruct + + + + + + + + + + + + + +
+
+ +
+ +

OpenStruct serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by constructing new Struct object with values v serialized +by to_json.

+
+ + + + + + +
+ + +
+
# File lib/json/add/ostruct.rb, line 11
+def self.json_create(object)
+  new(object['t'] || object[:t])
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/ostruct.rb, line 17
+def as_json(*)
+  klass = self.class.name
+  klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
+  {
+    JSON.create_id => klass,
+    't'            => table,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (OpenStruct) with this +struct’s values v as a JSON string.

+
+ + + + + + +
+ + +
+
# File lib/json/add/ostruct.rb, line 28
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Range.html b/doc/classes/Range.html new file mode 100644 index 0000000..59a84b8 --- /dev/null +++ b/doc/classes/Range.html @@ -0,0 +1,238 @@ + + + + + Range + + + + + + + + + + + + + +
+
+ +
+ +

Range serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by constructing new Range object with arguments a serialized +by to_json.

+
+ + + + + + +
+ + +
+
# File lib/json/add/range.rb, line 10
+def self.json_create(object)
+  new(*object['a'])
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/range.rb, line 16
+def as_json(*)
+  {
+    JSON.create_id  => self.class.name,
+    'a'             => [ first, last, exclude_end? ]
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (Range) with JSON array of arguments a which include +first (integer), last (integer), and +exclude_end? (boolean) as JSON string.

+
+ + + + + + +
+ + +
+
# File lib/json/add/range.rb, line 26
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Rational.html b/doc/classes/Rational.html new file mode 100644 index 0000000..6972079 --- /dev/null +++ b/doc/classes/Rational.html @@ -0,0 +1,227 @@ + + + + + Rational + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/rational.rb, line 7
+def self.json_create(object)
+  Rational(object['n'], object['d'])
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/rational.rb, line 11
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'n'            => numerator,
+    'd'            => denominator,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*) + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/json/add/rational.rb, line 19
+def to_json(*)
+  as_json.to_json
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Regexp.html b/doc/classes/Regexp.html new file mode 100644 index 0000000..bf76f47 --- /dev/null +++ b/doc/classes/Regexp.html @@ -0,0 +1,239 @@ + + + + + Regexp + + + + + + + + + + + + + +
+
+ +
+ +

Regexp serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by constructing new Regexp object with source s (Regexp or String) and options o +serialized by to_json

+
+ + + + + + +
+ + +
+
# File lib/json/add/regexp.rb, line 11
+def self.json_create(object)
+  new(object['s'], object['o'])
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/regexp.rb, line 17
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    'o'            => options,
+    's'            => source,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*) + +
+ + +
+

Stores class name (Regexp) with options +o and source s (Regexp +or String) as JSON string

+
+ + + + + + +
+ + +
+
# File lib/json/add/regexp.rb, line 27
+def to_json(*)
+  as_json.to_json
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Struct.html b/doc/classes/Struct.html new file mode 100644 index 0000000..8746cc4 --- /dev/null +++ b/doc/classes/Struct.html @@ -0,0 +1,239 @@ + + + + + Struct + + + + + + + + + + + + + +
+
+ +
+ +

Struct serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by constructing new Struct object with values v serialized +by to_json.

+
+ + + + + + +
+ + +
+
# File lib/json/add/struct.rb, line 10
+def self.json_create(object)
+  new(*object['v'])
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/struct.rb, line 16
+def as_json(*)
+  klass = self.class.name
+  klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
+  {
+    JSON.create_id => klass,
+    'v'            => values,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (Struct) with Struct values v as a JSON string. Only named structs are supported.

+
+ + + + + + +
+ + +
+
# File lib/json/add/struct.rb, line 27
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Symbol.html b/doc/classes/Symbol.html new file mode 100644 index 0000000..893cc4c --- /dev/null +++ b/doc/classes/Symbol.html @@ -0,0 +1,237 @@ + + + + + Symbol + + + + + + + + + + + + + +
+
+ +
+ +

Symbol serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(o) + +
+ + +
+

Deserializes JSON string by converting the +string value stored in the object to a Symbol

+
+ + + + + + +
+ + +
+
# File lib/json/add/symbol.rb, line 22
+def self.json_create(o)
+  o['s'].to_sym
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/symbol.rb, line 9
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    's'            => to_s,
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*a) + +
+ + +
+

Stores class name (Symbol) with String +representation of Symbol as a JSON string.

+
+ + + + + + +
+ + +
+
# File lib/json/add/symbol.rb, line 17
+def to_json(*a)
+  as_json.to_json(*a)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/classes/Time.html b/doc/classes/Time.html new file mode 100644 index 0000000..b8a1723 --- /dev/null +++ b/doc/classes/Time.html @@ -0,0 +1,244 @@ + + + + + Time + + + + + + + + + + + + + +
+
+ +
+ +

Time serialization/deserialization

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
J
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + json_create(object) + +
+ + +
+

Deserializes JSON string by converting time since +epoch to Time

+
+ + + + + + +
+ + +
+
# File lib/json/add/time.rb, line 9
+def self.json_create(object)
+  if usec = object.delete('u') # used to be tv_usec -> tv_nsec
+    object['n'] = usec * 1000
+  end
+  if instance_methods.include?(:tv_nsec)
+    at(object['s'], Rational(object['n'], 1000))
+  else
+    at(object['s'], object['n'] / 1000)
+  end
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + as_json(*) + +
+ + +
+

Returns a hash, that will be turned into a JSON +object and represent this object.

+
+ + + + + + +
+ + +
+
# File lib/json/add/time.rb, line 22
+def as_json(*)
+  {
+    JSON.create_id => self.class.name,
+    's'            => tv_sec,
+    'n'            => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
+  }
+end
+
+
+ +
+ +
+
+ + to_json(*args) + +
+ + +
+

Stores class name (Time) with number of seconds +since epoch and number of microseconds for Time as +JSON string

+
+ + + + + + +
+ + +
+
# File lib/json/add/time.rb, line 32
+def to_json(*args)
+  as_json.to_json(*args)
+end
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/doc/created.rid b/doc/created.rid new file mode 100644 index 0000000..4f8dbef --- /dev/null +++ b/doc/created.rid @@ -0,0 +1,24 @@ +Sat, 24 Dec 2011 15:52:11 +0100 +README.rdoc Sat, 24 Dec 2011 15:52:11 +0100 +lib/json.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/version.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/symbol.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/struct.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/complex.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/rational.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/exception.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/time.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/bigdecimal.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/date_time.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/core.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/range.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/date.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/regexp.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/add/ostruct.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/common.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/pure/generator.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/pure/parser.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/ext.rb Sat, 24 Dec 2011 15:52:11 +0100 +lib/json/pure.rb Sat, 24 Dec 2011 15:52:11 +0100 +ext/json/ext/parser/parser.c Sat, 24 Dec 2011 15:52:11 +0100 +ext/json/ext/generator/generator.c Sat, 24 Dec 2011 15:52:11 +0100 diff --git a/doc/css/github.css b/doc/css/github.css new file mode 100644 index 0000000..bd778a7 --- /dev/null +++ b/doc/css/github.css @@ -0,0 +1,129 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +pre code { + display: block; padding: 0.5em; + color: #000; + background: #f8f8ff +} + +pre .comment, +pre .template_comment, +pre .diff .header, +pre .javadoc { + color: #998; + font-style: italic +} + +pre .keyword, +pre .css .rule .keyword, +pre .winutils, +pre .javascript .title, +pre .lisp .title, +pre .subst { + color: #000; + font-weight: bold +} + +pre .number, +pre .hexcolor { + color: #40a070 +} + +pre .string, +pre .tag .value, +pre .phpdoc, +pre .tex .formula { + color: #d14 +} + +pre .title, +pre .id { + color: #900; + font-weight: bold +} + +pre .javascript .title, +pre .lisp .title, +pre .subst { + font-weight: normal +} + +pre .class .title, +pre .haskell .label, +pre .tex .command { + color: #458; + font-weight: bold +} + +pre .tag, +pre .tag .title, +pre .rules .property, +pre .django .tag .keyword { + color: #000080; + font-weight: normal +} + +pre .attribute, +pre .variable, +pre .instancevar, +pre .lisp .body { + color: #008080 +} + +pre .regexp { + color: #009926 +} + +pre .class { + color: #458; + font-weight: bold +} + +pre .symbol, +pre .ruby .symbol .string, +pre .ruby .symbol .keyword, +pre .ruby .symbol .keymethods, +pre .lisp .keyword, +pre .tex .special, +pre .input_number { + color: #990073 +} + +pre .builtin, +pre .built_in, +pre .lisp .title { + color: #0086b3 +} + +pre .preprocessor, +pre .pi, +pre .doctype, +pre .shebang, +pre .cdata { + color: #999; + font-weight: bold +} + +pre .deletion { + background: #fdd +} + +pre .addition { + background: #dfd +} + +pre .diff .change { + background: #0086b3 +} + +pre .chunk { + color: #aaa +} + +pre .tex .formula { + opacity: 0.5; +} diff --git a/doc/css/main.css b/doc/css/main.css new file mode 100755 index 0000000..862aa47 --- /dev/null +++ b/doc/css/main.css @@ -0,0 +1,326 @@ +body { + font-family: "Helvetica Neue", Arial, sans-serif; + background: #FFF; + color: #000; + margin: 0px; + font-size: 0.82em; + line-height: 1.25em; +} + +a { + color: #00F; + text-decoration: none; +} + +a:hover { + color: #333; + background: #FE8; +} + +p { + margin-bottom: 1em; +} + +h1 { + font-size: 2.1em; + font-weight: normal; + line-height: 1.2em; + margin: 1.4em 0 0.7em 0; +} + +h2 { + font-size: 1.6em; + margin: 1.8em 0 0.8em 0; + font-weight: normal; + line-height: 1.2em; +} + +h3 { + font-size: 1.4em; + color:#555; + margin: 1.4em 0 0.7em 0; + font-weight: normal; +} + +h4 { + margin: 1.4em 0 0.5em 0; + font-size: 1em; +} + +table +{ + margin-bottom: 1em; +} + +td, th +{ + padding: 0 0.7em 0.3em 0; +} + +th +{ + font-weight: bold; +} + +.clear +{ + clear: both; + width: 0; height: 0; +} + +dt +{ + margin-bottom: 0.3em; + font-weight: bold; +} + +dd +{ + margin-left: 2em; + margin-bottom: 1em; +} + +dd p +{ + margin-top: 0.6em; +} + +li +{ + margin: 0 0 0.5em 2em; +} + +ul li +{ + list-style: disc; +} + +ol li +{ + list-style: decimal; +} + +.banner +{ + background: #EDF3FE; + border-bottom: 1px solid #ccc; + padding: 1em 2em 0.5em 2em; +} +.banner h1 +{ + font-size: 1.2em; + margin: 0; +} + +.banner h1 .type +{ + font-size: 0.833em; + display:block; +} + +.banner h1 .type, +.banner h1 .parent +{ + color: #666; +} + +.banner ul +{ + margin-top: 0.3em; + margin-bottom: 0; + font-size: 0.85em; +} + +.banner li +{ + list-style: none; + margin-left: 0; + margin-bottom: 0; +} + +pre +{ + margin-bottom: 1em; +} + +.methods dt +{ + width: 1em; + font-size: 1.5em; + color:#AAA; + position: absolute; + font-weight: normal; + margin: 0; +} + +.methods dd +{ + margin-left: 2.5em; + min-height: 1.8em; + -height: 1.8em; + padding-bottom: 0.8em; +} + + +.methods ul li +{ + margin-right: 0.7em; + margin-left: 0; + list-style: none; + display: inline; +} + +#content { + margin: 2em; + margin-left: 3.5em; + margin-right: 3.5em; +} + + +.sectiontitle { + margin-top: 2em; + margin-bottom: 1.3em; + margin-left: -1.2em; + font-size: 1.2em; + padding: 0 0 0.25em 0; + font-weight: bold; + border-bottom: 1px solid #000; +} + +.contenttitle { + margin-top: 4em; + margin-bottom: 1.3em; + margin-left: -0.9em; + font-size: 1.6em; + padding: 0 0 0.25em 0; + font-weight: bold; +} + +.attr-rw { + padding-right: 1em; + text-align: center; + color: #055; +} + +.attr-name { + font-weight: bold; + padding-right: 1em; +} + +.attr-desc { +} + +tt { + font-size: 1.15em; +} + +.attr-value { + font-family: monospace; + padding-left: 1em; + font-size: 1.15em; +} + +.dyn-source { + display: none; + background: #fffde8; + color: #000; + border: #ffe0bb dotted 1px; + margin: 0.5em 2em 0.5em 0; + padding: 0.5em; +} + +.dyn-source .cmt { + color: #00F; + font-style: italic; +} + +.dyn-source .kw { + color: #070; + font-weight: bold; +} + +.description pre { + padding: 0.5em; + border: #ffe0bb dotted 1px; + background: #fffde8; +} + +.method { + margin-bottom: 2em; +} +.method .description, +.method .sourcecode +{ + margin-left: 1.2em; +} +.method h4 +{ + border-bottom: 1px dotted #999; + padding: 0 0 0.2em 0; + margin-bottom: 0.8em; + font-size: 1.1em; + color:#333; +} +.method .method-title { + border-bottom: 1px dotted #666; + padding: 0 0 0.15em 0; + margin: 0 0 0.5em 0; + font-size: 1.2em; + line-height: 1.25em; +} + +.method .sourcecode p.source-link { + text-indent: 0em; + margin-top: 0.5em; +} + +.method .aka { + margin-top: 0.3em; + margin-left: 1em; + font-style: italic; + text-indent: 2em; +} + +.method .source-link +{ + font-size: 0.85em; +} + +.ruby-constant { + color: teal; +} +.ruby-keyword { + color: #000; + font-weight: bold +} +.ruby-title { + color: #900; + font-weight: bold; +} +.ruby-ivar { + color: teal; +} +.ruby-operator { + color: #000; + font-weight: bold +} +.ruby-identifier { + color: #000; +} +.ruby-string, +.ruby-node { + color: #D14; +} +.ruby-comment { + color: #998; + font-style: italic; +} +.ruby-regexp { + color: #009926; +} +.ruby-value { + color: #990073; +} +.ruby-number { + color: #40A070; +} diff --git a/doc/css/panel.css b/doc/css/panel.css new file mode 100755 index 0000000..9bd8027 --- /dev/null +++ b/doc/css/panel.css @@ -0,0 +1,384 @@ +/* Panel (begin) */ + .panel + { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + background: #FFF; + z-index: 2; + font-family: "Helvetica Neue", "Arial", sans-serif; + //zoom: 1; + } + + .panel_tree .results, + .panel_results .tree + { + display: none; + } + + /* Header with search box (begin) */ + .panel .header + { + width: 100%; + height: 29px; + border-bottom: 1px solid #666; + position: relative; + left: 0; top: 0; + background: #e8e8e8; + } + + .panel .header div + { + margin: 0 7px; + } + .panel .header table + { + height: 29px; + width: 100%; + } + + .panel .header table td + { + vertical-align: middle; + text-align: middle; + } + + .panel .header label + { + position: absolute; + font-size: 12px; + line-height: 29px; + margin-left: 3px; + color: #999; + cursor: text; + } + + .panel .header table input + { + width: 100%; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + display: inline-block; + -webkit-appearance: searchfield; + height: 22px; + //height: auto; + } + + /* Header with search box (end) */ + + + /* Results (begin) */ + .panel .result + { + position: absolute; + top: 30px; + bottom: 0; + left: 0; + width: 100%; + //height: expression((this.parentNode.offsetHeight - 31)); + overflow-y: scroll; + overflow-x: hidden; + -overflow-y: hidden; + background: #EDF3FE url(../i/results_bg.png); + z-index: 2; + //zoom:1; + } + + .panel .result ul + { + font-size: 0.8em; + width: 100%; + background: #EDF3FE url(../i/results_bg.png); + //zoom:1; + } + + .panel .result ul li + { + height: 46px; + -height: 50px; + //display: inline; + //width: 100%; + //zoom: 1; + overflow: hidden; + padding: 4px 10px 0 10px; + cursor: pointer; + } + + .panel .result ul li h1 + { + font-size: 13px; + font-weight: normal; + color: #333; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .result ul li p + { + font-size: 11px; + color: #333; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .result ul li h1 i, + .panel .result ul li p.snippet + { + color: #999; + } + + .panel .result ul li b + { + color: #000; + } + + .panel .result ul li.current + { + background: #3875D7; + } + + .panel .result ul li.current h1, + .panel .result ul li.current p + { + color: #DDD; + } + + .panel .result ul li.current h1 i, + .panel .result ul li.current p.snippet + { + color: #AAA; + } + + .panel .result ul li.current b + { + color: #FFF; + } + + + .panel .result ul li:hover, + .panel .result ul li.selected + { + background: #d0d0d0; + } + + .panel .result ul li.current:hover + { + background: #2965C0; + } + + .panel .result ul li .badge + { + margin-right: 0.4em; + margin-left: -0.2em; + padding: 0 0.2em; + color: #000; + border-radius: 3px; + } + + .panel .result ul li .badge_1 + { + background: #ACDBF4; + } + + .panel .result ul li.current .badge_1 + { + background: #97BFD7; + } + + .panel .result ul li .badge_2 + { + background: #ACF3C3; + } + + .panel .result ul li.current .badge_2 + { + background: #98D7AC; + } + + .panel .result ul li .badge_3 + { + background: #E0F3AC; + } + + .panel .result ul li.current .badge_3 + { + background: #C4D798; + } + + .panel .result ul li .badge_4 + { + background: #D7CA98; + } + + .panel .result ul li.current .badge_4 + { + background: #A6B0AC; + } + + .panel .result ul li .badge_5 + { + background: #F3C8AC; + } + + .panel .result ul li.current .badge_5 + { + background: #D7B198; + } + + .panel .result ul li .badge_6 + { + background: #F3ACC3; + } + + .panel .result ul li.current .badge_6 + { + background: #D798AB; + } + + /* Results (end) */ + + /* Tree (begin) */ /**/ + .panel .tree + { + position: absolute; + top: 30px; + bottom: 0; + left: 0; + width: 100%; + //zoom: 1; + //height: expression((this.parentNode.offsetHeight - 31)); + overflow-y: scroll; + overflow-x: hidden; + -overflow-y: hidden; + background: #EDF3FE url(../i/tree_bg.png); + z-index: 30; + } + + .panel .tree ul + { + background: #EDF3FE url(../i/tree_bg.png); + } + + .panel .tree li + { + cursor: pointer; + overflow: hidden; + //height: 23px; + //display: inline; + //zoom: 1; + //width: 100%; + } + + + .panel .tree li .content + { + padding-left: 18px; + padding-top: 5px; + height: 18px; + overflow: hidden; + position: relative; + } + + .panel .tree li .icon + { + width: 10px; + height: 9px; + background: url(../i/arrows.png); + background-position: 0 -9px; + position: absolute; + left: 1px; + top: 8px; + cursor: default; + } + + .panel .tree li.closed .icon + { + background-position: 0 0; + } + + .panel .tree ul li h1 + { + font-size: 13px; + font-weight: normal; + color: #000; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .tree ul li p + { + font-size: 11px; + color: #666; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .tree ul li h1 i + { + color: #999; + font-style: normal; + } + + .panel .tree ul li.empty + { + cursor: text; + } + + .panel .tree ul li.empty h1, + .panel .tree ul li.empty p + { + color: #666; + font-style: italic; + } + + .panel .tree ul li.current + { + background: #3875D7; + } + + .panel .tree ul li.current .icon + { + background-position: -10px -9px; + } + + .panel .tree ul li.current.closed .icon + { + background-position: -10px 0; + } + + .panel .tree ul li.current h1 + { + color: #FFF; + } + + .panel .tree ul li.current p + { + color: #CCC; + } + + .panel .tree ul li.current.empty h1, + .panel .tree ul li.current.empty p + { + color: #999; + } + + .panel .tree ul li:hover + { + background: #d0d0d0; + } + + .panel .tree ul li.current:hover + { + background: #2965C0; + } + + .panel .tree .stopper + { + display: none; + } + /* Tree (end) */ /**/ + +/* Panel (end) */ \ No newline at end of file diff --git a/doc/css/reset.css b/doc/css/reset.css new file mode 100755 index 0000000..da4a239 --- /dev/null +++ b/doc/css/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ */ +/* v1.0 | 20080212 */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file diff --git a/doc/favicon.ico b/doc/favicon.ico new file mode 100644 index 0000000..e0e80cf Binary files /dev/null and b/doc/favicon.ico differ diff --git a/doc/files/README_rdoc.html b/doc/files/README_rdoc.html new file mode 100644 index 0000000..28964bc --- /dev/null +++ b/doc/files/README_rdoc.html @@ -0,0 +1,493 @@ + + + + + README.rdoc + + + + + + + + + + + + + + +
+
+ +
+ +

JSON implementation for Ruby travis-ci.org/flori/json.png?branch=master

+ +

Description

+ +

This is a implementation of the JSON +specification according to RFC 4627 www.ietf.org/rfc/rfc4627.txt +. Starting from version 1.0.0 on there will be two variants available:

+
  • +

    A pure ruby variant, that relies on the iconv and the stringscan +extensions, which are both part of the ruby standard library.

    +
  • +

    The quite a bit faster C extension variant, which is in parts implemented +in C and comes with its own unicode conversion functions and a parser +generated by the ragel state machine compiler www.cs.queensu.ca/~thurston/ragel +.

    +
+ +

Both variants of the JSON generator +generate UTF-8 character sequences by default. If an :ascii_only option +with a true value is given, they escape all non-ASCII and control +characters with uXXXX escape sequences, and support UTF-16 surrogate pairs +in order to be able to generate the whole range of unicode code points.

+ +

All strings, that are to be encoded as JSON strings, should be UTF-8 byte +sequences on the Ruby side. To encode raw binary strings, that aren’t UTF-8 +encoded, please use the to_json_raw_object method of String (which produces +an object, that contains a byte array) and decode the result on the +receiving endpoint.

+ +

The JSON parsers can parse UTF-8, +UTF-16BE, UTF-16LE, UTF-32BE, and UTF-32LE JSON documents under Ruby 1.8. Under Ruby +1.9 they take advantage of Ruby’s M17n features and can parse all documents +which have the correct String#encoding set. If a document string has +ASCII-8BIT as an encoding the parser attempts to figure out which of the +UTF encodings from above it is and trys to parse it.

+ +

Installation

+ +

It’s recommended to use the extension variant of JSON, because it’s faster than the pure +ruby variant. If you cannot build it on your system, you can settle for the +latter.

+ +

Just type into the command line as root:

+ +
# rake install
+ +

The above command will build the extensions and install them on your +system.

+ +
# rake install_pure
+ +

or

+ +
# ruby install.rb
+ +

will just install the pure ruby implementation of JSON.

+ +

If you use Rubygems you can type

+ +
# gem install json
+ +

instead, to install the newest JSON +version.

+ +

There is also a pure ruby json only variant of the gem, that can be +installed with:

+ +
# gem install json_pure
+ +

Compiling the extensions yourself

+ +

If you want to build the extensions yourself you need rake:

+ +
You can get it from rubyforge:
+  http://rubyforge.org/projects/rake
+
+or just type
+
+# gem install rake
+
+for the installation via rubygems.
+ +

If you want to create the parser.c file from its parser.rl file or draw +nice graphviz images of the state machines, you need ragel from: www.cs.queensu.ca/~thurston/ragel

+ +

Usage

+ +

To use JSON you can

+ +
require 'json'
+
+ +

to load the installed variant (either the extension ‘json’ or the pure +variant ‘json_pure’). If you have installed the extension variant, you can +pick either the extension variant or the pure variant by typing

+ +
require 'json/ext'
+
+ +

or

+ +
require 'json/pure'
+
+ +

Now you can parse a JSON document into a +ruby data structure by calling

+ +
JSON.parse(document)
+ +

If you want to generate a JSON document +from a ruby data structure call

+ +
JSON.generate(data)
+ +

You can also use the pretty_generate method (which formats the output more +verbosely and nicely) or fast_generate (which doesn’t do any of the +security checks generate performs, e. g. nesting deepness checks).

+ +

To create a valid JSON document you have +to make sure, that the output is embedded in either a JSON array [] or a JSON object {}. The easiest way to do this, +is by putting your values in a Ruby Array or Hash instance.

+ +

There are also the JSON and JSON[] +methods which use parse on a String or generate a JSON document from an array or hash:

+ +
document = JSON 'test'  => 23 # => "{\"test\":23}"
+document = JSON['test'] => 23 # => "{\"test\":23}"
+
+ +

and

+ +
data = JSON '{"test":23}'  # => {"test"=>23}
+data = JSON['{"test":23}'] # => {"test"=>23}
+
+ +

You can choose to load a set of common additions to ruby core’s objects if +you

+ +
require 'json/add/core'
+
+ +

After requiring this you can, e. g., serialise/deserialise Ruby ranges:

+ +
JSON JSON(1..10) # => 1..10
+
+ +

To find out how to add JSON support to +other or your own classes, read the section “More Examples” below.

+ +

To get the best compatibility to rails’ JSON implementation, you can

+ +
require 'json/add/rails'
+
+ +

Both of the additions attempt to require ‘json’ (like above) first, if it +has not been required yet.

+ +

More Examples

+ +

To create a JSON document from a ruby +data structure, you can call JSON#generate like that:

+ +
json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
+# => "[1,2,{\"a\":3.141},false,true,null,\"4..10\"]"
+
+ +

To get back a ruby data structure from a JSON document, you have to call JSON#parse on it:

+ +
JSON.parse json
+# => [1, 2, {"a"=>3.141}, false, true, nil, "4..10"]
+
+ +

Note, that the range from the original data structure is a simple string +now. The reason for this is, that JSON +doesn’t support ranges or arbitrary classes. In this case the json library +falls back to call Object#to_json, which is the same as to_s.to_json.

+ +

It’s possible to add JSON support +serialization to arbitrary classes by simply implementing a more +specialized version of the to_json method, that should return a JSON object (a hash converted to JSON with to_json) like this (don’t forget +the *a for all the arguments):

+ +
class Range
+  def to_json(*a)
+    {
+      'json_class'   => self.class.name, # = 'Range'
+      'data'         => [ first, last, exclude_end? ]
+    }.to_json(*a)
+  end
+end
+
+ +

The hash key ‘json_class’ is the class, that will be asked to deserialise +the JSON representation later. In this +case it’s ‘Range’, but any namespace of the form ‘A::B’ or ‘::A::B’ will +do. All other keys are arbitrary and can be used to store the necessary +data to configure the object to be deserialised.

+ +

If a the key ‘json_class’ is found in a JSON object, the JSON parser checks if the given class +responds to the json_create class method. If so, it is called with the JSON object converted to a Ruby hash. So a +range can be deserialised by implementing Range.json_create +like this:

+ +
class Range
+  def self.json_create(o)
+    new(*o['data'])
+  end
+end
+
+ +

Now it possible to serialise/deserialise ranges as well:

+ +
json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
+# => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
+JSON.parse json
+# => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
+
+ +

JSON#generate always +creates the shortest possible string representation of a ruby data +structure in one line. This is good for data storage or network protocols, +but not so good for humans to read. Fortunately there’s also JSON#pretty_generate +(or JSON#pretty_generate) +that creates a more readable output:

+ +
puts JSON.pretty_generate([1, 2, {"a"=>3.141}, false, true, nil, 4..10])
+[
+  1,
+  2,
+  {
+    "a": 3.141
+  },
+  false,
+  true,
+  null,
+  {
+    "json_class": "Range",
+    "data": [
+      4,
+      10,
+      false
+    ]
+  }
+]
+
+ +

There are also the methods Kernel#j for generate, and Kernel#jj for +pretty_generate output to the console, that work analogous to Core Ruby’s p +and the pp library’s pp methods.

+ +

The script tools/server.rb contains a small example if you want to test, +how receiving a JSON object from a +webrick server in your browser with the javasript prototype library www.prototypejs.org works.

+ +

Speed Comparisons

+ +

I have created some benchmark results (see the benchmarks/data-p4-3Ghz +subdir of the package) for the JSON-parser to estimate the speed up in the +C extension:

+ +
Comparing times (call_time_mean):
+ 1 ParserBenchmarkExt#parser   900 repeats:
+       553.922304770 (  real) ->   21.500x 
+         0.001805307
+ 2 ParserBenchmarkYAML#parser  1000 repeats:
+       224.513358139 (  real) ->    8.714x 
+         0.004454078
+ 3 ParserBenchmarkPure#parser  1000 repeats:
+        26.755020642 (  real) ->    1.038x 
+         0.037376163
+ 4 ParserBenchmarkRails#parser 1000 repeats:
+        25.763381731 (  real) ->    1.000x 
+         0.038814780
+           calls/sec (  time) ->    speed  covers
+           secs/call
+ +

In the table above 1 is JSON::Ext::Parser, 2 is +YAML.load with YAML compatbile JSON +document, 3 is is JSON::Pure::Parser, and 4 is +ActiveSupport::JSON.decode. The ActiveSupport JSON-decoder converts the +input first to YAML and then uses the YAML-parser, the conversion seems to +slow it down so much that it is only as fast as the JSON::Pure::Parser!

+ +

If you look at the benchmark data you can see that this is mostly caused by +the frequent high outliers - the median of the Rails-parser runs is still +overall smaller than the median of the JSON::Pure::Parser runs:

+ +
Comparing times (call_time_median):
+ 1 ParserBenchmarkExt#parser   900 repeats:
+       800.592479481 (  real) ->   26.936x 
+         0.001249075
+ 2 ParserBenchmarkYAML#parser  1000 repeats:
+       271.002390644 (  real) ->    9.118x 
+         0.003690004
+ 3 ParserBenchmarkRails#parser 1000 repeats:
+        30.227910865 (  real) ->    1.017x 
+         0.033082008
+ 4 ParserBenchmarkPure#parser  1000 repeats:
+        29.722384421 (  real) ->    1.000x 
+         0.033644676
+           calls/sec (  time) ->    speed  covers
+           secs/call
+ +

I have benchmarked the JSON-Generator as well. This generated a few more +values, because there are different modes that also influence the achieved +speed:

+ +
Comparing times (call_time_mean):
+ 1 GeneratorBenchmarkExt#generator_fast    1000 repeats:
+       547.354332608 (  real) ->   15.090x 
+         0.001826970
+ 2 GeneratorBenchmarkExt#generator_safe    1000 repeats:
+       443.968212317 (  real) ->   12.240x 
+         0.002252414
+ 3 GeneratorBenchmarkExt#generator_pretty  900 repeats:
+       375.104545883 (  real) ->   10.341x 
+         0.002665923
+ 4 GeneratorBenchmarkPure#generator_fast   1000 repeats:
+        49.978706968 (  real) ->    1.378x 
+         0.020008521
+ 5 GeneratorBenchmarkRails#generator       1000 repeats:
+        38.531868759 (  real) ->    1.062x 
+         0.025952543
+ 6 GeneratorBenchmarkPure#generator_safe   1000 repeats:
+        36.927649925 (  real) ->    1.018x 7 (>=3859)
+         0.027079979
+ 7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
+        36.272134441 (  real) ->    1.000x 6 (>=3859)
+         0.027569373
+           calls/sec (  time) ->    speed  covers
+           secs/call
+ +

In the table above 1-3 are JSON::Ext::Generator methods. +4, 6, and 7 are JSON::Pure::Generator +methods and 5 is the Rails JSON +generator. It is now a bit faster than the generator_safe and +generator_pretty methods of the pure variant but slower than the others.

+ +

To achieve the fastest JSON document +output, you can use the fast_generate method. Beware, that this will +disable the checking for circular Ruby data structures, which may cause JSON to go into an infinite loop.

+ +

Here are the median comparisons for completeness’ sake:

+ +
Comparing times (call_time_median):
+ 1 GeneratorBenchmarkExt#generator_fast    1000 repeats:
+       708.258020939 (  real) ->   16.547x 
+         0.001411915
+ 2 GeneratorBenchmarkExt#generator_safe    1000 repeats:
+       569.105020353 (  real) ->   13.296x 
+         0.001757145
+ 3 GeneratorBenchmarkExt#generator_pretty  900 repeats:
+       482.825371244 (  real) ->   11.280x 
+         0.002071142
+ 4 GeneratorBenchmarkPure#generator_fast   1000 repeats:
+        62.717626652 (  real) ->    1.465x 
+         0.015944481
+ 5 GeneratorBenchmarkRails#generator       1000 repeats:
+        43.965681162 (  real) ->    1.027x 
+         0.022745013
+ 6 GeneratorBenchmarkPure#generator_safe   1000 repeats:
+        43.929073409 (  real) ->    1.026x 7 (>=3859)
+         0.022763968
+ 7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
+        42.802514491 (  real) ->    1.000x 6 (>=3859)
+         0.023363113
+           calls/sec (  time) ->    speed  covers
+           secs/call
+ +

Author

+ +

Florian Frank <flori@ping.de>

+ +

License

+ +

Ruby License, see the COPYING file included in the source distribution. The +Ruby License includes the GNU General Public License (GPL), Version 2, so +see the file GPL as well.

+ +

Download

+ +

The latest version of this library can be downloaded at

+ + +

Online Documentation should be located at

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/ext/json/ext/generator/generator_c.html b/doc/files/ext/json/ext/generator/generator_c.html new file mode 100644 index 0000000..1f21f2d --- /dev/null +++ b/doc/files/ext/json/ext/generator/generator_c.html @@ -0,0 +1,67 @@ + + + + + generator.c + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/ext/json/ext/parser/parser_c.html b/doc/files/ext/json/ext/parser/parser_c.html new file mode 100644 index 0000000..1c50994 --- /dev/null +++ b/doc/files/ext/json/ext/parser/parser_c.html @@ -0,0 +1,67 @@ + + + + + parser.c + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/bigdecimal_rb.html b/doc/files/lib/json/add/bigdecimal_rb.html new file mode 100644 index 0000000..8451f66 --- /dev/null +++ b/doc/files/lib/json/add/bigdecimal_rb.html @@ -0,0 +1,88 @@ + + + + + bigdecimal.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
  • bigdecimal
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/complex_rb.html b/doc/files/lib/json/add/complex_rb.html new file mode 100644 index 0000000..c529802 --- /dev/null +++ b/doc/files/lib/json/add/complex_rb.html @@ -0,0 +1,88 @@ + + + + + complex.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
  • complex
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/core_rb.html b/doc/files/lib/json/add/core_rb.html new file mode 100644 index 0000000..e5171f0 --- /dev/null +++ b/doc/files/lib/json/add/core_rb.html @@ -0,0 +1,96 @@ + + + + + core.rb + + + + + + + + + + + + + + +
+
+ +
+ +

This file requires the implementations of ruby core’s custom objects for +serialisation/deserialisation.

+ +
+ + + + + +
Required Files
+
    + +
  • json/add/date
  • + +
  • json/add/date_time
  • + +
  • json/add/exception
  • + +
  • json/add/range
  • + +
  • json/add/regexp
  • + +
  • json/add/struct
  • + +
  • json/add/symbol
  • + +
  • json/add/time
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/date_rb.html b/doc/files/lib/json/add/date_rb.html new file mode 100644 index 0000000..1fcb5c0 --- /dev/null +++ b/doc/files/lib/json/add/date_rb.html @@ -0,0 +1,88 @@ + + + + + date.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
  • date
  • + +
+ + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Date +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/date_time_rb.html b/doc/files/lib/json/add/date_time_rb.html new file mode 100644 index 0000000..a1429fc --- /dev/null +++ b/doc/files/lib/json/add/date_time_rb.html @@ -0,0 +1,88 @@ + + + + + date_time.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
  • date
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/exception_rb.html b/doc/files/lib/json/add/exception_rb.html new file mode 100644 index 0000000..6010e70 --- /dev/null +++ b/doc/files/lib/json/add/exception_rb.html @@ -0,0 +1,86 @@ + + + + + exception.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/ostruct_rb.html b/doc/files/lib/json/add/ostruct_rb.html new file mode 100644 index 0000000..49e30e8 --- /dev/null +++ b/doc/files/lib/json/add/ostruct_rb.html @@ -0,0 +1,88 @@ + + + + + ostruct.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
  • ostruct
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/range_rb.html b/doc/files/lib/json/add/range_rb.html new file mode 100644 index 0000000..02487d2 --- /dev/null +++ b/doc/files/lib/json/add/range_rb.html @@ -0,0 +1,86 @@ + + + + + range.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
+ + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Range +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/rational_rb.html b/doc/files/lib/json/add/rational_rb.html new file mode 100644 index 0000000..fa8da10 --- /dev/null +++ b/doc/files/lib/json/add/rational_rb.html @@ -0,0 +1,88 @@ + + + + + rational.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
  • rational
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/regexp_rb.html b/doc/files/lib/json/add/regexp_rb.html new file mode 100644 index 0000000..01c0594 --- /dev/null +++ b/doc/files/lib/json/add/regexp_rb.html @@ -0,0 +1,86 @@ + + + + + regexp.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/struct_rb.html b/doc/files/lib/json/add/struct_rb.html new file mode 100644 index 0000000..90ce437 --- /dev/null +++ b/doc/files/lib/json/add/struct_rb.html @@ -0,0 +1,86 @@ + + + + + struct.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/symbol_rb.html b/doc/files/lib/json/add/symbol_rb.html new file mode 100644 index 0000000..1ae78fd --- /dev/null +++ b/doc/files/lib/json/add/symbol_rb.html @@ -0,0 +1,86 @@ + + + + + symbol.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/add/time_rb.html b/doc/files/lib/json/add/time_rb.html new file mode 100644 index 0000000..0026d3f --- /dev/null +++ b/doc/files/lib/json/add/time_rb.html @@ -0,0 +1,86 @@ + + + + + time.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json
  • + +
+ + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Time +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/common_rb.html b/doc/files/lib/json/common_rb.html new file mode 100644 index 0000000..216473a --- /dev/null +++ b/doc/files/lib/json/common_rb.html @@ -0,0 +1,128 @@ + + + + + common.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • json/version
  • + +
  • iconv
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/ext_rb.html b/doc/files/lib/json/ext_rb.html new file mode 100644 index 0000000..ac7d6eb --- /dev/null +++ b/doc/files/lib/json/ext_rb.html @@ -0,0 +1,97 @@ + + + + + ext.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • simplecov
  • + +
  • json/common
  • + +
  • json/ext/parser
  • + +
  • json/ext/generator
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/pure/generator_rb.html b/doc/files/lib/json/pure/generator_rb.html new file mode 100644 index 0000000..da0eaa3 --- /dev/null +++ b/doc/files/lib/json/pure/generator_rb.html @@ -0,0 +1,148 @@ + + + + + generator.rb + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/files/lib/json/pure/parser_rb.html b/doc/files/lib/json/pure/parser_rb.html new file mode 100644 index 0000000..e59846e --- /dev/null +++ b/doc/files/lib/json/pure/parser_rb.html @@ -0,0 +1,96 @@ + + + + + parser.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • strscan
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/pure_rb.html b/doc/files/lib/json/pure_rb.html new file mode 100644 index 0000000..48ffd79 --- /dev/null +++ b/doc/files/lib/json/pure_rb.html @@ -0,0 +1,97 @@ + + + + + pure.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • simplecov
  • + +
  • json/common
  • + +
  • json/pure/parser
  • + +
  • json/pure/generator
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json/version_rb.html b/doc/files/lib/json/version_rb.html new file mode 100644 index 0000000..85706da --- /dev/null +++ b/doc/files/lib/json/version_rb.html @@ -0,0 +1,78 @@ + + + + + version.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + MODULE + JSON +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/files/lib/json_rb.html b/doc/files/lib/json_rb.html new file mode 100644 index 0000000..e90944b --- /dev/null +++ b/doc/files/lib/json_rb.html @@ -0,0 +1,156 @@ + + + + + json.rb + + + + + + + + + + + + + + +
+
+ +
+ +

JavaScript Object Notation (JSON)

+ +

JSON is a lightweight +data-interchange format. It is easy for us humans to read and write. Plus, +equally simple for machines to generate or parse. JSON is completely language agnostic, +making it the ideal interchange format.

+ +

Built on two universally available structures:

+ +
1. A collection of name/value pairs. Often referred to as an _object_, hash table, record, struct, keyed list, or associative array.
+2. An ordered list of values. More commonly called an _array_, vector, sequence or list.
+ +

To read more about JSON visit: json.org

+ +

Parsing JSON

+ +

To parse a JSON string received by +another application or generated within your existing application:

+ +
require 'json'
+
+my_hash = JSON.parse('{"hello": "goodbye"}')
+puts my_hash["hello"] => "goodbye"
+
+ +

Notice the extra quotes '' around the hash notation. Ruby +expects the argument to be a string and can’t convert objects like a hash +or array.

+ +

Ruby converts your string into a hash

+ +

Generating JSON

+ +

Creating a JSON string for +communication or serialization is just as simple.

+ +
require 'json'
+
+my_hash = {:hello => "goodbye"}
+puts JSON.generate(my_hash) => "{\"hello\":\"goodbye\"}"
+
+ +

Or an alternative way:

+ +
require 'json'
+puts {:hello => "goodbye"}.to_json => "{\"hello\":\"goodbye\"}"
+
+ +

JSON.generate only allows objects or arrays to be converted to +JSON syntax. to_json, +however, accepts many Ruby classes even though it acts only as a method for +serialization:

+ +
require 'json'
+
+1.to_json => "1"
+
+ +
+ + + + + +
Required Files
+
    + +
  • json/common
  • + +
  • json/version
  • + +
  • json/ext
  • + +
  • json/pure
  • + +
+ + + + + + + + + +
Namespace
+
    + +
  • + MODULE + JSON +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/doc/i/arrows.png b/doc/i/arrows.png new file mode 100755 index 0000000..e54060f Binary files /dev/null and b/doc/i/arrows.png differ diff --git a/doc/i/results_bg.png b/doc/i/results_bg.png new file mode 100755 index 0000000..199ba69 Binary files /dev/null and b/doc/i/results_bg.png differ diff --git a/doc/i/tree_bg.png b/doc/i/tree_bg.png new file mode 100755 index 0000000..7d23663 Binary files /dev/null and b/doc/i/tree_bg.png differ diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..2d8d00c --- /dev/null +++ b/doc/index.html @@ -0,0 +1,13 @@ + + + + + JSON Implementation for Ruby + + + + + + diff --git a/doc/js/highlight.pack.js b/doc/js/highlight.pack.js new file mode 100755 index 0000000..01b5927 --- /dev/null +++ b/doc/js/highlight.pack.js @@ -0,0 +1 @@ +var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/"}while(x.length||y.length){var u=t().splice(0,1)[0];v+=l(w.substr(q,u.offset-q));q=u.offset;if(u.event=="start"){v+=r(u.node);s.push(u.node)}else{if(u.event=="stop"){var p=s.length;do{p--;var o=s[p];v+=("")}while(o!=u.node);s.splice(p,1);while(p'+l(K[0])+""}else{M+=l(K[0])}O=N.lR.lastIndex;K=N.lR.exec(L)}M+=l(L.substr(O,L.length-O));return M}function J(r,L){if(L.sL&&d[L.sL]){var K=f(L.sL,r);s+=K.keyword_count;return K.value}else{return E(r,L)}}function H(L,r){var K=L.cN?'':"";if(L.rB){p+=K;L.buffer=""}else{if(L.eB){p+=l(r)+K;L.buffer=""}else{p+=K;L.buffer=r}}B.push(L);A+=L.r}function D(N,K,P){var Q=B[B.length-1];if(P){p+=J(Q.buffer+N,Q);return false}var L=y(K,Q);if(L){p+=J(Q.buffer+N,Q);H(L,K);return L.rB}var r=v(B.length-1,K);if(r){var M=Q.cN?"":"";if(Q.rE){p+=J(Q.buffer+N,Q)+M}else{if(Q.eE){p+=J(Q.buffer+N,Q)+M+l(K)}else{p+=J(Q.buffer+N+K,Q)+M}}while(r>1){M=B[B.length-2].cN?"":"";p+=M;r--;B.length--}var O=B[B.length-1];B.length--;B[B.length-1].buffer="";if(O.starts){H(O.starts,"")}return Q.rE}if(w(K,Q)){throw"Illegal"}}var G=d[I];var B=[G.dM];var A=0;var s=0;var p="";try{var u=0;G.dM.buffer="";do{var x=q(C,u);var t=D(x[0],x[1],x[2]);u+=x[0].length;if(!t){u+=x[1].length}}while(!x[2]);if(B.length>1){throw"Illegal"}return{language:I,r:A,keyword_count:s,value:p}}catch(F){if(F=="Illegal"){return{language:null,r:0,keyword_count:0,value:l(C)}}else{throw F}}}function h(){function o(t,s,u){if(t.compiled){return}if(!u){t.bR=c(s,t.b?t.b:"\\B|\\b");if(!t.e&&!t.eW){t.e="\\B|\\b"}if(t.e){t.eR=c(s,t.e)}}if(t.i){t.iR=c(s,t.i)}if(t.r==undefined){t.r=1}if(t.k){t.lR=c(s,t.l||hljs.IR,true)}for(var r in t.k){if(!t.k.hasOwnProperty(r)){continue}if(t.k[r] instanceof Object){t.kG=t.k}else{t.kG={keyword:t.k}}break}if(!t.c){t.c=[]}t.compiled=true;for(var q=0;qx.keyword_count+x.r){x=u}if(u.keyword_count+u.r>w.keyword_count+w.r){x=w;w=u}}}var s=t.className;if(!s.match(w.language)){s=s?(s+" "+w.language):w.language}var o=b(t);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=k(o,b(q),A)}if(y){w.value=w.value.replace(/^((<[^>]+>|\t)+)/gm,function(B,E,D,C){return E.replace(/\t/g,y)})}if(p){w.value=w.value.replace(/\n/g,"
")}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){var q=t.parentNode;var v=document.createElement("div");v.innerHTML="
"+w.value+"
";t=v.firstChild.firstChild;v.firstChild.cN=q.cN;q.parentNode.replaceChild(v.firstChild,q)}else{t.innerHTML=w.value}t.className=s;t.dataset={};t.dataset.result={language:w.language,kw:w.keyword_count,re:w.r};if(x&&x.language){t.dataset.second_best={language:x.language,kw:x.keyword_count,re:x.r}}}function j(){if(j.called){return}j.called=true;e();var q=document.getElementsByTagName("pre");for(var o=0;o|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(o,r){var q={};for(var p in o){q[p]=o[p]}if(r){for(var p in r){q[p]=r[p]}}return q}}();hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/.*?[^\\\\/]/[gim]*"}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@font-face",l:"[a-z-]+",k:{"font-face":1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"",rE:true,sL:"css"}},{cN:"tag",b:"",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.cpp=function(){var b={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};var a={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b.built_in,r:10};a.c=[a];return{dM:{k:b,i:")[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/doc/js/jquery-effect.js b/doc/js/jquery-effect.js new file mode 100755 index 0000000..5b25307 --- /dev/null +++ b/doc/js/jquery-effect.js @@ -0,0 +1,593 @@ +/* + * jQuery UI Effects 1.6rc6 + * + * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +;(function($) { + +$.effects = $.effects || {}; //Add the 'effects' scope + +$.extend($.effects, { + version: "1.6rc6", + + // Saves a set of properties in a data storage + save: function(element, set) { + for(var i=0; i < set.length; i++) { + if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); + } + }, + + // Restores a set of previously saved properties from a data storage + restore: function(element, set) { + for(var i=0; i < set.length; i++) { + if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); + } + }, + + setMode: function(el, mode) { + if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle + return mode; + }, + + getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value + // this should be a little more flexible in the future to handle a string & hash + var y, x; + switch (origin[0]) { + case 'top': y = 0; break; + case 'middle': y = 0.5; break; + case 'bottom': y = 1; break; + default: y = origin[0] / original.height; + }; + switch (origin[1]) { + case 'left': x = 0; break; + case 'center': x = 0.5; break; + case 'right': x = 1; break; + default: x = origin[1] / original.width; + }; + return {x: x, y: y}; + }, + + // Wraps the element around a wrapper that copies position properties + createWrapper: function(element) { + + //if the element is already wrapped, return it + if (element.parent().is('.ui-effects-wrapper')) + return element.parent(); + + //Cache width,height and float properties of the element, and create a wrapper around it + var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') }; + element.wrap('
'); + var wrapper = element.parent(); + + //Transfer the positioning of the element to the wrapper + if (element.css('position') == 'static') { + wrapper.css({ position: 'relative' }); + element.css({ position: 'relative'} ); + } else { + var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto'; + var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto'; + wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show(); + element.css({position: 'relative', top: 0, left: 0 }); + } + + wrapper.css(props); + return wrapper; + }, + + removeWrapper: function(element) { + if (element.parent().is('.ui-effects-wrapper')) + return element.parent().replaceWith(element); + return element; + }, + + setTransition: function(element, list, factor, value) { + value = value || {}; + $.each(list, function(i, x){ + unit = element.cssUnit(x); + if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; + }); + return value; + }, + + //Base function to animate from one class to another in a seamless transition + animateClass: function(value, duration, easing, callback) { + + var cb = (typeof easing == "function" ? easing : (callback ? callback : null)); + var ea = (typeof easing == "string" ? easing : null); + + return this.each(function() { + + var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || ''; + if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */ + if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; } + + //Let's get a style offset + var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle)); + if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove); + var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle)); + if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove); + + // The main function to form the object for animation + for(var n in newStyle) { + if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */ + && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */ + && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */ + && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */ + && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */ + ) offset[n] = newStyle[n]; + } + + that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object + // Change style attribute back to original. For stupid IE, we need to clear the damn object. + if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr); + if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove); + if(cb) cb.apply(this, arguments); + }); + + }); + } +}); + + +function _normalizeArguments(a, m) { + + var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m; + var speed = a[1] && a[1].constructor != Object ? a[1] : o.duration; //either comes from options.duration or the second argument + speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default; + var callback = o.callback || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] ); + + return [a[0], o, speed, callback]; + +} + +//Extend the methods of jQuery +$.fn.extend({ + + //Save old methods + _show: $.fn.show, + _hide: $.fn.hide, + __toggle: $.fn.toggle, + _addClass: $.fn.addClass, + _removeClass: $.fn.removeClass, + _toggleClass: $.fn.toggleClass, + + // New effect methods + effect: function(fx, options, speed, callback) { + return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null; + }, + + show: function() { + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) + return this._show.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'show')); + } + }, + + hide: function() { + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) + return this._hide.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'hide')); + } + }, + + toggle: function(){ + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (arguments[0].constructor == Function)) + return this.__toggle.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'toggle')); + } + }, + + addClass: function(classNames, speed, easing, callback) { + return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); + }, + removeClass: function(classNames,speed,easing,callback) { + return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); + }, + toggleClass: function(classNames,speed,easing,callback) { + return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed); + }, + morph: function(remove,add,speed,easing,callback) { + return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); + }, + switchClass: function() { + return this.morph.apply(this, arguments); + }, + + // helper functions + cssUnit: function(key) { + var style = this.css(key), val = []; + $.each( ['em','px','%','pt'], function(i, unit){ + if(style.indexOf(unit) > 0) + val = [parseFloat(style), unit]; + }); + return val; + } +}); + +/* + * jQuery Color Animations + * Copyright 2007 John Resig + * Released under the MIT and GPL licenses. + */ + +// We override the animation for all of these color styles +$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ + $.fx.step[attr] = function(fx) { + if ( fx.state == 0 ) { + fx.start = getColor( fx.elem, attr ); + fx.end = getRGB( fx.end ); + } + + fx.elem.style[attr] = "rgb(" + [ + Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0) + ].join(",") + ")"; + }; +}); + +// Color Conversion functions from highlightFade +// By Blair Mitchelmore +// http://jquery.offput.ca/highlightFade/ + +// Parse strings looking for color tuples [255,255,255] +function getRGB(color) { + var result; + + // Check if we're already dealing with an array of colors + if ( color && color.constructor == Array && color.length == 3 ) + return color; + + // Look for rgb(num,num,num) + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) + return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + + // Look for rgb(num%,num%,num%) + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) + return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + + // Look for #a0b1c2 + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + + // Look for #fff + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + + // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) + return colors['transparent']; + + // Otherwise, we're most likely dealing with a named color + return colors[$.trim(color).toLowerCase()]; +} + +function getColor(elem, attr) { + var color; + + do { + color = $.curCSS(elem, attr); + + // Keep going until we find an element that has color, or we hit the body + if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) + break; + + attr = "backgroundColor"; + } while ( elem = elem.parentNode ); + + return getRGB(color); +}; + +// Some named colors to work with +// From Interface by Stefan Petre +// http://interface.eyecon.ro/ + +var colors = { + aqua:[0,255,255], + azure:[240,255,255], + beige:[245,245,220], + black:[0,0,0], + blue:[0,0,255], + brown:[165,42,42], + cyan:[0,255,255], + darkblue:[0,0,139], + darkcyan:[0,139,139], + darkgrey:[169,169,169], + darkgreen:[0,100,0], + darkkhaki:[189,183,107], + darkmagenta:[139,0,139], + darkolivegreen:[85,107,47], + darkorange:[255,140,0], + darkorchid:[153,50,204], + darkred:[139,0,0], + darksalmon:[233,150,122], + darkviolet:[148,0,211], + fuchsia:[255,0,255], + gold:[255,215,0], + green:[0,128,0], + indigo:[75,0,130], + khaki:[240,230,140], + lightblue:[173,216,230], + lightcyan:[224,255,255], + lightgreen:[144,238,144], + lightgrey:[211,211,211], + lightpink:[255,182,193], + lightyellow:[255,255,224], + lime:[0,255,0], + magenta:[255,0,255], + maroon:[128,0,0], + navy:[0,0,128], + olive:[128,128,0], + orange:[255,165,0], + pink:[255,192,203], + purple:[128,0,128], + violet:[128,0,128], + red:[255,0,0], + silver:[192,192,192], + white:[255,255,255], + yellow:[255,255,0], + transparent: [255,255,255] +}; + +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +$.easing.jswing = $.easing.swing; + +$.extend($.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert($.easing.default); + return $.easing[$.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +})(jQuery); + +/* + * jQuery UI Effects Highlight 1.6rc6 + * + * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.highlight = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['backgroundImage','backgroundColor','opacity']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode + var color = o.options.color || "#ffff99"; // Default highlight color + var oldColor = el.css("backgroundColor"); + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + el.css({backgroundImage: 'none', backgroundColor: color}); // Shift + + // Animation + var animation = {backgroundColor: oldColor }; + if (mode == "hide") animation['opacity'] = 0; + + // Animate + el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == "hide") el.hide(); + $.effects.restore(el, props); + if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter'); + if(o.callback) o.callback.apply(this, arguments); + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); \ No newline at end of file diff --git a/doc/js/main.js b/doc/js/main.js new file mode 100755 index 0000000..859772b --- /dev/null +++ b/doc/js/main.js @@ -0,0 +1,24 @@ +function toggleSource(id) +{ + var src = $('#' + id).toggle(); + var isVisible = src.is(':visible'); + $('#l_' + id).html(isVisible ? 'hide' : 'show'); + if (!src.data('syntax-higlighted')) { + src.data('syntax-higlighted', 1); + hljs.highlightBlock(src[0]); + } +} + +window.highlight = function(url) { + var hash = url.match(/#([^#]+)$/) + if(hash) { + $('a[name=' + hash[1] + ']').parent().effect('highlight', {}, 'slow') + } +} + +$(function() { + highlight('#' + location.hash); + $('.description pre').each(function() { + hljs.highlightBlock(this); + }); +}); diff --git a/doc/js/navigation.js b/doc/js/navigation.js new file mode 100644 index 0000000..e412681 --- /dev/null +++ b/doc/js/navigation.js @@ -0,0 +1,142 @@ +/* + * Navigation allows movement using the arrow keys through the search results. + * + * When using this library you will need to set scrollIntoView to the + * appropriate function for your layout. Use scrollInWindow if the container + * is not scrollable and scrollInElement if the container is a separate + * scrolling region. + */ +Navigation = new function() { + this.initNavigation = function() { + var _this = this; + + $(document).keydown(function(e) { + _this.onkeydown(e); + }).keyup(function(e) { + _this.onkeyup(e); + }); + + this.navigationActive = true; + } + + this.setNavigationActive = function(state) { + this.navigationActive = state; + this.clearMoveTimeout(); + } + + this.onkeyup = function(e) { + if (!this.navigationActive) return; + + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + case 38: //Event.KEY_UP: + case 39: //Event.KEY_RIGHT: + case 40: //Event.KEY_DOWN: + this.clearMoveTimeout(); + break; + } + } + + this.onkeydown = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + if (this.moveLeft()) e.preventDefault(); + break; + case 38: //Event.KEY_UP: + if (e.keyCode == 38 || e.ctrlKey) { + if (this.moveUp()) e.preventDefault(); + this.startMoveTimeout(false); + } + break; + case 39: //Event.KEY_RIGHT: + if (this.moveRight()) e.preventDefault(); + break; + case 40: //Event.KEY_DOWN: + if (e.keyCode == 40 || e.ctrlKey) { + if (this.moveDown()) e.preventDefault(); + this.startMoveTimeout(true); + } + break; + case 13: //Event.KEY_RETURN: + if (this.$current) + e.preventDefault(); + this.select(this.$current); + break; + } + if (e.ctrlKey && e.shiftKey) this.select(this.$current); + } + + this.clearMoveTimeout = function() { + clearTimeout(this.moveTimeout); + this.moveTimeout = null; + } + + this.startMoveTimeout = function(isDown) { + if (!$.browser.mozilla && !$.browser.opera) return; + if (this.moveTimeout) this.clearMoveTimeout(); + var _this = this; + + var go = function() { + if (!_this.moveTimeout) return; + _this[isDown ? 'moveDown' : 'moveUp'](); + _this.moveTimout = setTimeout(go, 100); + } + this.moveTimeout = setTimeout(go, 200); + } + + this.moveRight = function() { + } + + this.moveLeft = function() { + } + + this.move = function(isDown) { + } + + this.moveUp = function() { + return this.move(false); + } + + this.moveDown = function() { + return this.move(true); + } + + /* + * Scrolls to the given element in the scrollable element view. + */ + this.scrollInElement = function(element, view) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = view.offsetHeight; + viewScroll = view.scrollTop; + + if (offset - viewScroll + height > viewHeight) { + view.scrollTop = offset - viewHeight + height; + } + if (offset < viewScroll) { + view.scrollTop = offset; + } + } + + /* + * Scrolls to the given element in the window. The second argument is + * ignored + */ + this.scrollInWindow = function(element, ignored) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = window.innerHeight; + viewScroll = window.scrollY; + + if (offset - viewScroll + height > viewHeight) { + window.scrollTo(window.scrollX, offset - viewHeight + height); + } + if (offset < viewScroll) { + window.scrollTo(window.scrollX, offset); + } + } +} + diff --git a/doc/js/search_index.js b/doc/js/search_index.js new file mode 100644 index 0000000..47a872c --- /dev/null +++ b/doc/js/search_index.js @@ -0,0 +1 @@ +var search_data = {"index":{"searchIndex":["bigdecimal","class","complex","date","datetime","exception","json","circulardatastructure","ext","generator","generatormethods","array","bignum","falseclass","fixnum","float","hash","nilclass","object","string","extend","trueclass","state","parser","generatorerror","jsonerror","missingunicodesupport","nestingerror","parsererror","pure","generator","generatormethods","array","falseclass","float","hash","integer","nilclass","object","string","extend","trueclass","state","parser","unparsererror","kernel","openstruct","range","rational","regexp","struct","symbol","time","[]()","[]()","[]()","allow_nan?()","allow_nan?()","array_nl()","array_nl=()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","as_json()","ascii_only?()","ascii_only?()","buffer_initial_length()","buffer_initial_length=()","check_circular?()","check_circular?()","configure()","configure()","const_defined_in?()","depth()","depth=()","dump()","fast_generate()","from_state()","from_state()","generate()","generate()","generate()","iconv()","included()","included()","indent()","indent=()","initialize_copy()","json_creatable?()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","json_create()","load()","max_nesting()","max_nesting=()","merge()","merge()","new()","new()","new()","new()","object_nl()","object_nl=()","parse()","parse()","parse()","parse!()","pretty_generate()","quirks_mode()","quirks_mode=()","quirks_mode?()","quirks_mode?()","quirks_mode?()","quirks_mode?()","recurse_proc()","reset()","restore()","source()","space()","space=()","space_before()","space_before=()","to_h()","to_h()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json()","to_json_raw()","to_json_raw()","to_json_raw_object()","to_json_raw_object()","readme"],"longSearchIndex":["bigdecimal","class","complex","date","datetime","exception","json","json::circulardatastructure","json::ext","json::ext::generator","json::ext::generator::generatormethods","json::ext::generator::generatormethods::array","json::ext::generator::generatormethods::bignum","json::ext::generator::generatormethods::falseclass","json::ext::generator::generatormethods::fixnum","json::ext::generator::generatormethods::float","json::ext::generator::generatormethods::hash","json::ext::generator::generatormethods::nilclass","json::ext::generator::generatormethods::object","json::ext::generator::generatormethods::string","json::ext::generator::generatormethods::string::extend","json::ext::generator::generatormethods::trueclass","json::ext::generator::state","json::ext::parser","json::generatorerror","json::jsonerror","json::missingunicodesupport","json::nestingerror","json::parsererror","json::pure","json::pure::generator","json::pure::generator::generatormethods","json::pure::generator::generatormethods::array","json::pure::generator::generatormethods::falseclass","json::pure::generator::generatormethods::float","json::pure::generator::generatormethods::hash","json::pure::generator::generatormethods::integer","json::pure::generator::generatormethods::nilclass","json::pure::generator::generatormethods::object","json::pure::generator::generatormethods::string","json::pure::generator::generatormethods::string::extend","json::pure::generator::generatormethods::trueclass","json::pure::generator::state","json::pure::parser","json::unparsererror","kernel","openstruct","range","rational","regexp","struct","symbol","time","json::[]()","json::ext::generator::state#[]()","json::pure::generator::state#[]()","json::ext::generator::state#allow_nan?()","json::pure::generator::state#allow_nan?()","json::ext::generator::state#array_nl()","json::ext::generator::state#array_nl=()","bigdecimal#as_json()","complex#as_json()","date#as_json()","datetime#as_json()","exception#as_json()","openstruct#as_json()","range#as_json()","rational#as_json()","regexp#as_json()","struct#as_json()","symbol#as_json()","time#as_json()","json::ext::generator::state#ascii_only?()","json::pure::generator::state#ascii_only?()","json::ext::generator::state#buffer_initial_length()","json::ext::generator::state#buffer_initial_length=()","json::ext::generator::state#check_circular?()","json::pure::generator::state#check_circular?()","json::ext::generator::state#configure()","json::pure::generator::state#configure()","json::const_defined_in?()","json::ext::generator::state#depth()","json::ext::generator::state#depth=()","json#dump()","json#fast_generate()","json::ext::generator::state::from_state()","json::pure::generator::state::from_state()","json#generate()","json::ext::generator::state#generate()","json::pure::generator::state#generate()","json::iconv()","json::ext::generator::generatormethods::string::included()","json::pure::generator::generatormethods::string::included()","json::ext::generator::state#indent()","json::ext::generator::state#indent=()","json::ext::generator::state#initialize_copy()","class#json_creatable?()","bigdecimal::json_create()","complex::json_create()","date::json_create()","datetime::json_create()","exception::json_create()","json::ext::generator::generatormethods::string::extend#json_create()","json::pure::generator::generatormethods::string::extend#json_create()","openstruct::json_create()","range::json_create()","rational::json_create()","regexp::json_create()","struct::json_create()","symbol::json_create()","time::json_create()","json#load()","json::ext::generator::state#max_nesting()","json::ext::generator::state#max_nesting=()","json::ext::generator::state#merge()","json::pure::generator::state#merge()","json::ext::generator::state::new()","json::ext::parser::new()","json::pure::generator::state::new()","json::pure::parser::new()","json::ext::generator::state#object_nl()","json::ext::generator::state#object_nl=()","json#parse()","json::ext::parser#parse()","json::pure::parser#parse()","json#parse!()","json#pretty_generate()","json::ext::generator::state#quirks_mode()","json::ext::generator::state#quirks_mode=()","json::ext::generator::state#quirks_mode?()","json::ext::parser#quirks_mode?()","json::pure::generator::state#quirks_mode?()","json::pure::parser#quirks_mode?()","json#recurse_proc()","json::pure::parser#reset()","json::restore()","json::ext::parser#source()","json::ext::generator::state#space()","json::ext::generator::state#space=()","json::ext::generator::state#space_before()","json::ext::generator::state#space_before=()","json::ext::generator::state#to_h()","json::pure::generator::state#to_h()","bigdecimal#to_json()","complex#to_json()","date#to_json()","datetime#to_json()","exception#to_json()","json::ext::generator::generatormethods::array#to_json()","json::ext::generator::generatormethods::bignum#to_json()","json::ext::generator::generatormethods::falseclass#to_json()","json::ext::generator::generatormethods::fixnum#to_json()","json::ext::generator::generatormethods::float#to_json()","json::ext::generator::generatormethods::hash#to_json()","json::ext::generator::generatormethods::nilclass#to_json()","json::ext::generator::generatormethods::object#to_json()","json::ext::generator::generatormethods::string#to_json()","json::ext::generator::generatormethods::trueclass#to_json()","json::pure::generator::generatormethods::array#to_json()","json::pure::generator::generatormethods::falseclass#to_json()","json::pure::generator::generatormethods::float#to_json()","json::pure::generator::generatormethods::hash#to_json()","json::pure::generator::generatormethods::integer#to_json()","json::pure::generator::generatormethods::nilclass#to_json()","json::pure::generator::generatormethods::object#to_json()","json::pure::generator::generatormethods::string#to_json()","json::pure::generator::generatormethods::trueclass#to_json()","openstruct#to_json()","range#to_json()","rational#to_json()","regexp#to_json()","struct#to_json()","symbol#to_json()","time#to_json()","json::ext::generator::generatormethods::string#to_json_raw()","json::pure::generator::generatormethods::string#to_json_raw()","json::ext::generator::generatormethods::string#to_json_raw_object()","json::pure::generator::generatormethods::string#to_json_raw_object()",""],"info":[["BigDecimal","","classes/BigDecimal.html","",""],["Class","","classes/Class.html","","

Extends any Class to include json_creatable? method.\n"],["Complex","","classes/Complex.html","",""],["Date","","classes/Date.html","","

Date serialization/deserialization\n"],["DateTime","","classes/DateTime.html","","

DateTime serialization/deserialization\n"],["Exception","","classes/Exception.html","","

Exception serialization/deserialization\n"],["JSON","","classes/JSON.html","",""],["JSON::CircularDatastructure","","classes/JSON/CircularDatastructure.html","",""],["JSON::Ext","","classes/JSON/Ext.html","","

This module holds all the modules/classes that implement JSON’s\nfunctionality as C extensions.\n"],["JSON::Ext::Generator","","classes/JSON/Ext/Generator.html","","

This is the JSON generator implemented as a C extension. It can be\nconfigured to be used by setting\n\n

JSON.generator ...
\n"],["JSON::Ext::Generator::GeneratorMethods","","classes/JSON/Ext/Generator/GeneratorMethods.html","",""],["JSON::Ext::Generator::GeneratorMethods::Array","","classes/JSON/Ext/Generator/GeneratorMethods/Array.html","",""],["JSON::Ext::Generator::GeneratorMethods::Bignum","","classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html","",""],["JSON::Ext::Generator::GeneratorMethods::FalseClass","","classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html","",""],["JSON::Ext::Generator::GeneratorMethods::Fixnum","","classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html","",""],["JSON::Ext::Generator::GeneratorMethods::Float","","classes/JSON/Ext/Generator/GeneratorMethods/Float.html","",""],["JSON::Ext::Generator::GeneratorMethods::Hash","","classes/JSON/Ext/Generator/GeneratorMethods/Hash.html","",""],["JSON::Ext::Generator::GeneratorMethods::NilClass","","classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html","",""],["JSON::Ext::Generator::GeneratorMethods::Object","","classes/JSON/Ext/Generator/GeneratorMethods/Object.html","",""],["JSON::Ext::Generator::GeneratorMethods::String","","classes/JSON/Ext/Generator/GeneratorMethods/String.html","",""],["JSON::Ext::Generator::GeneratorMethods::String::Extend","","classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html","",""],["JSON::Ext::Generator::GeneratorMethods::TrueClass","","classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html","",""],["JSON::Ext::Generator::State","","classes/JSON/Ext/Generator/State.html","",""],["JSON::Ext::Parser","","classes/JSON/Ext/Parser.html","","

This is the JSON parser implemented as a C extension. It can be configured\nto be used by setting\n\n

JSON.parser ...
\n"],["JSON::GeneratorError","","classes/JSON/GeneratorError.html","","

This exception is raised if a generator or unparser error occurs.\n"],["JSON::JSONError","","classes/JSON/JSONError.html","","

The base exception for JSON errors.\n"],["JSON::MissingUnicodeSupport","","classes/JSON/MissingUnicodeSupport.html","","

This exception is raised if the required unicode support is missing on the\nsystem. Usually this means …\n"],["JSON::NestingError","","classes/JSON/NestingError.html","","

This exception is raised if the nesting of parsed data structures is too\ndeep.\n"],["JSON::ParserError","","classes/JSON/ParserError.html","","

This exception is raised if a parser error occurs.\n"],["JSON::Pure","","classes/JSON/Pure.html","","

This module holds all the modules/classes that implement JSON’s\nfunctionality in pure ruby.\n"],["JSON::Pure::Generator","","classes/JSON/Pure/Generator.html","",""],["JSON::Pure::Generator::GeneratorMethods","","classes/JSON/Pure/Generator/GeneratorMethods.html","",""],["JSON::Pure::Generator::GeneratorMethods::Array","","classes/JSON/Pure/Generator/GeneratorMethods/Array.html","",""],["JSON::Pure::Generator::GeneratorMethods::FalseClass","","classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html","",""],["JSON::Pure::Generator::GeneratorMethods::Float","","classes/JSON/Pure/Generator/GeneratorMethods/Float.html","",""],["JSON::Pure::Generator::GeneratorMethods::Hash","","classes/JSON/Pure/Generator/GeneratorMethods/Hash.html","",""],["JSON::Pure::Generator::GeneratorMethods::Integer","","classes/JSON/Pure/Generator/GeneratorMethods/Integer.html","",""],["JSON::Pure::Generator::GeneratorMethods::NilClass","","classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html","",""],["JSON::Pure::Generator::GeneratorMethods::Object","","classes/JSON/Pure/Generator/GeneratorMethods/Object.html","",""],["JSON::Pure::Generator::GeneratorMethods::String","","classes/JSON/Pure/Generator/GeneratorMethods/String.html","",""],["JSON::Pure::Generator::GeneratorMethods::String::Extend","","classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html","","

Module that holds the extinding methods if, the String module is included.\n"],["JSON::Pure::Generator::GeneratorMethods::TrueClass","","classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html","",""],["JSON::Pure::Generator::State","","classes/JSON/Pure/Generator/State.html","","

This class is used to create State instances, that are use to hold data\nwhile generating a JSON text …\n"],["JSON::Pure::Parser","","classes/JSON/Pure/Parser.html","","

This class implements the JSON parser that is used to parse a JSON string\ninto a Ruby data structure. …\n"],["JSON::UnparserError","","classes/JSON/GeneratorError.html","","

This exception is raised if a generator or unparser error occurs.\n"],["Kernel","","classes/Kernel.html","",""],["OpenStruct","","classes/OpenStruct.html","","

OpenStruct serialization/deserialization\n"],["Range","","classes/Range.html","","

Range serialization/deserialization\n"],["Rational","","classes/Rational.html","",""],["Regexp","","classes/Regexp.html","","

Regexp serialization/deserialization\n"],["Struct","","classes/Struct.html","","

Struct serialization/deserialization\n"],["Symbol","","classes/Symbol.html","","

Symbol serialization/deserialization\n"],["Time","","classes/Time.html","","

Time serialization/deserialization\n"],["[]","JSON","classes/JSON.html#method-c-5B-5D","(object, opts = {})","

If object is string-like, parse the string and return the parsed\nresult as a Ruby data structure. Otherwise …\n"],["[]","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-5B-5D","(p1)","

Return the value returned by method name.\n"],["[]","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-5B-5D","(name)","

Return the value returned by method name.\n"],["allow_nan?","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-allow_nan-3F","()","

Returns true, if NaN, Infinity, and -Infinity should be generated,\notherwise returns false.\n"],["allow_nan?","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-allow_nan-3F","()","

Returns true if NaN, Infinity, and -Infinity should be considered as valid\nJSON and output.\n"],["array_nl","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-array_nl","()","

This string is put at the end of a line that holds a JSON array.\n"],["array_nl=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-array_nl-3D","(p1)","

This string is put at the end of a line that holds a JSON array.\n"],["as_json","BigDecimal","classes/BigDecimal.html#method-i-as_json","(*)",""],["as_json","Complex","classes/Complex.html#method-i-as_json","(*)",""],["as_json","Date","classes/Date.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","DateTime","classes/DateTime.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","Exception","classes/Exception.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","OpenStruct","classes/OpenStruct.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","Range","classes/Range.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","Rational","classes/Rational.html#method-i-as_json","(*)",""],["as_json","Regexp","classes/Regexp.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","Struct","classes/Struct.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","Symbol","classes/Symbol.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["as_json","Time","classes/Time.html#method-i-as_json","(*)","

Returns a hash, that will be turned into a JSON object and represent this\nobject.\n"],["ascii_only?","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-ascii_only-3F","()","

Returns true, if NaN, Infinity, and -Infinity should be generated,\notherwise returns false.\n"],["ascii_only?","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-ascii_only-3F","()","

Returns true, if only ASCII characters should be generated. Otherwise\nreturns false.\n"],["buffer_initial_length","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-buffer_initial_length","()","

This integer returns the current inital length of the buffer.\n"],["buffer_initial_length=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-buffer_initial_length-3D","(p1)","

This sets the initial length of the buffer to length, if\nlength > 0, otherwise its value isn’t changed. …\n"],["check_circular?","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-check_circular-3F","()","

Returns true, if circular data structures should be checked, otherwise\nreturns false.\n"],["check_circular?","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-check_circular-3F","()","

Returns true, if circular data structures are checked, otherwise returns\nfalse.\n"],["configure","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-configure","(p1)","

Configure this State instance with the Hash opts, and return\nitself.\n"],["configure","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-configure","(opts)","

Configure this State instance with the Hash opts, and return\nitself.\n"],["const_defined_in?","JSON","classes/JSON.html#method-c-const_defined_in-3F","(modul, constant)",""],["depth","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-depth","()","

This integer returns the current depth of data structure nesting.\n"],["depth=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-depth-3D","(p1)","

This sets the maximum level of data structure nesting in the generated JSON\nto the integer depth, max_nesting …\n"],["dump","JSON","classes/JSON.html#method-i-dump","(obj, anIO = nil, limit = nil)","

Dumps obj as a JSON string, i.e. calls generate on the object and\nreturns the result.\n

If anIO (an IO-like …\n"],["fast_generate","JSON","classes/JSON.html#method-i-fast_generate","(obj, opts = nil)","

Generate a JSON document from the Ruby data structure obj and\nreturn it. This method disables the checks …\n"],["from_state","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-c-from_state","(p1)","

Creates a State object from opts, which ought to be Hash to create\na new State instance configured by …\n"],["from_state","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-c-from_state","(opts)","

Creates a State object from opts, which ought to be Hash to create\na new State instance configured by …\n"],["generate","JSON","classes/JSON.html#method-i-generate","(obj, opts = nil)","

Generate a JSON document from the Ruby data structure obj and\nreturn it. state is * a JSON::State object, …\n"],["generate","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-generate","(p1)","

Generates a valid JSON document from object obj and returns\nthe result. If no valid JSON document can …\n"],["generate","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-generate","(obj)","

Generates a valid JSON document from object obj and returns\nthe result. If no valid JSON document can …\n"],["iconv","JSON","classes/JSON.html#method-c-iconv","(to, from, string)","

Encodes string using Ruby’s String.encode\n"],["included","JSON::Ext::Generator::GeneratorMethods::String","classes/JSON/Ext/Generator/GeneratorMethods/String.html#method-c-included","(p1)","

Extends modul with the String::Extend module.\n"],["included","JSON::Pure::Generator::GeneratorMethods::String","classes/JSON/Pure/Generator/GeneratorMethods/String.html#method-c-included","(modul)","

Extends modul with the String::Extend module.\n"],["indent","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-indent","()","

This string is used to indent levels in the JSON text.\n"],["indent=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-indent-3D","(p1)","

This string is used to indent levels in the JSON text.\n"],["initialize_copy","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-initialize_copy","(p1)","

Initializes this object from orig if it to be duplicated/cloned and returns\nit.\n"],["json_creatable?","Class","classes/Class.html#method-i-json_creatable-3F","()","

Returns true if this class can be used to create an instance from a\nserialised JSON string. The class …\n"],["json_create","BigDecimal","classes/BigDecimal.html#method-c-json_create","(object)",""],["json_create","Complex","classes/Complex.html#method-c-json_create","(object)",""],["json_create","Date","classes/Date.html#method-c-json_create","(object)","

Deserializes JSON string by converting Julian year y, month\nm, day d and Day of Calendar Reform\nsg to …\n"],["json_create","DateTime","classes/DateTime.html#method-c-json_create","(object)","

Deserializes JSON string by converting year y, month\nm, day d, hour H, minute\nM, second S, offset of …\n"],["json_create","Exception","classes/Exception.html#method-c-json_create","(object)","

Deserializes JSON string by constructing new Exception object with message\nm and backtrace b serialized …\n"],["json_create","JSON::Ext::Generator::GeneratorMethods::String::Extend","classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html#method-i-json_create","(p1)","

Raw Strings are JSON Objects (the raw bytes are stored in an array for the\nkey “raw”). The …\n"],["json_create","JSON::Pure::Generator::GeneratorMethods::String::Extend","classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html#method-i-json_create","(o)","

Raw Strings are JSON Objects (the raw bytes are stored in an array for the\nkey “raw”). The …\n"],["json_create","OpenStruct","classes/OpenStruct.html#method-c-json_create","(object)","

Deserializes JSON string by constructing new Struct object with values\nv serialized by to_json.\n"],["json_create","Range","classes/Range.html#method-c-json_create","(object)","

Deserializes JSON string by constructing new Range object with arguments\na serialized by to_json.\n"],["json_create","Rational","classes/Rational.html#method-c-json_create","(object)",""],["json_create","Regexp","classes/Regexp.html#method-c-json_create","(object)","

Deserializes JSON string by constructing new Regexp object with source\ns (Regexp or String) and options …\n"],["json_create","Struct","classes/Struct.html#method-c-json_create","(object)","

Deserializes JSON string by constructing new Struct object with values\nv serialized by to_json.\n"],["json_create","Symbol","classes/Symbol.html#method-c-json_create","(o)","

Deserializes JSON string by converting the string value stored\nin the object to a Symbol\n"],["json_create","Time","classes/Time.html#method-c-json_create","(object)","

Deserializes JSON string by converting time since epoch to Time\n"],["load","JSON","classes/JSON.html#method-i-load","(source, proc = nil)","

Load a ruby data structure from a JSON source and return it. A\nsource can either be a string-like object, …\n"],["max_nesting","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-max_nesting","()","

This integer returns the maximum level of data structure nesting in the\ngenerated JSON, max_nesting = …\n"],["max_nesting=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-max_nesting-3D","(p1)","

This sets the maximum level of data structure nesting in the generated JSON\nto the integer depth, max_nesting …\n"],["merge","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-merge","(p1)",""],["merge","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-merge","(opts)",""],["new","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-c-new","(p1 = v1)","

Instantiates a new State object, configured by opts.\n

opts can have the following keys:\n

indent: a string …\n"],["new","JSON::Ext::Parser","classes/JSON/Ext/Parser.html#method-c-new","(p1, p2 = v2)","

Creates a new JSON::Ext::Parser instance for the string source.\n

Creates a new JSON::Ext::Parser instance …\n"],["new","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-c-new","(opts = {})","

Instantiates a new State object, configured by opts.\n

opts can have the following keys:\n

indent: a string …\n"],["new","JSON::Pure::Parser","classes/JSON/Pure/Parser.html#method-c-new","(source, opts = {})","

Creates a new JSON::Pure::Parser instance for the string source.\n

It will be configured by the opts hash. …\n"],["object_nl","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-object_nl","()","

This string is put at the end of a line that holds a JSON object (or Hash).\n"],["object_nl=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-object_nl-3D","(p1)","

This string is put at the end of a line that holds a JSON object (or Hash).\n"],["parse","JSON","classes/JSON.html#method-i-parse","(source, opts = {})","

Parse the JSON document source into a Ruby data structure and\nreturn it.\n

opts can have the following keys: …\n"],["parse","JSON::Ext::Parser","classes/JSON/Ext/Parser.html#method-i-parse","()","

Parses the current JSON text source and returns the complete data\nstructure as a result.\n"],["parse","JSON::Pure::Parser","classes/JSON/Pure/Parser.html#method-i-parse","()","

Parses the current JSON string source and returns the complete\ndata structure as a result.\n"],["parse!","JSON","classes/JSON.html#method-i-parse-21","(source, opts = {})","

Parse the JSON document source into a Ruby data structure and\nreturn it. The bang version of the parse …\n"],["pretty_generate","JSON","classes/JSON.html#method-i-pretty_generate","(obj, opts = nil)","

Generate a JSON document from the Ruby data structure obj and\nreturn it. The returned document is a prettier …\n"],["quirks_mode","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-quirks_mode","()","

Returns true, if quirks mode is enabled. Otherwise returns false.\n"],["quirks_mode=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-quirks_mode-3D","(p1)","

If set to true, enables the quirks_mode mode.\n"],["quirks_mode?","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-quirks_mode-3F","()","

Returns true, if quirks mode is enabled. Otherwise returns false.\n"],["quirks_mode?","JSON::Ext::Parser","classes/JSON/Ext/Parser.html#method-i-quirks_mode-3F","()","

Returns a true, if this parser is in quirks_mode, false otherwise.\n"],["quirks_mode?","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-quirks_mode-3F","()","

Returns true, if quirks mode is enabled. Otherwise returns false.\n"],["quirks_mode?","JSON::Pure::Parser","classes/JSON/Pure/Parser.html#method-i-quirks_mode-3F","()",""],["recurse_proc","JSON","classes/JSON.html#method-i-recurse_proc","(result, &proc)","

Recursively calls passed Proc if the parsed data structure is an\nArray or Hash\n"],["reset","JSON::Pure::Parser","classes/JSON/Pure/Parser.html#method-i-reset","()",""],["restore","JSON","classes/JSON.html#method-c-restore","(source, proc = nil)",""],["source","JSON::Ext::Parser","classes/JSON/Ext/Parser.html#method-i-source","()","

Returns a copy of the current source string, that was used to\nconstruct this Parser.\n"],["space","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-space","()","

This string is used to insert a space between the tokens in a JSON string.\n"],["space=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-space-3D","(p1)","

This string is used to insert a space between the tokens in a JSON string.\n"],["space_before","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-space_before","()","

This string is used to insert a space before the ‘:’ in JSON objects.\n"],["space_before=","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-space_before-3D","(p1)","

This string is used to insert a space before the ‘:’ in JSON objects.\n"],["to_h","JSON::Ext::Generator::State","classes/JSON/Ext/Generator/State.html#method-i-to_h","()","

Returns the configuration instance variables as a hash, that can be passed\nto the configure method.\n"],["to_h","JSON::Pure::Generator::State","classes/JSON/Pure/Generator/State.html#method-i-to_h","()","

Returns the configuration instance variables as a hash, that can be passed\nto the configure method.\n"],["to_json","BigDecimal","classes/BigDecimal.html#method-i-to_json","(*)",""],["to_json","Complex","classes/Complex.html#method-i-to_json","(*)",""],["to_json","Date","classes/Date.html#method-i-to_json","(*args)","

Stores class name (Date) with Julian year y, month\nm, day d and Day of Calendar Reform\nsg as JSON string …\n"],["to_json","DateTime","classes/DateTime.html#method-i-to_json","(*args)","

Stores class name (DateTime) with Julian year y, month\nm, day d, hour H, minute\nM, second S, offset …\n"],["to_json","Exception","classes/Exception.html#method-i-to_json","(*args)","

Stores class name (Exception) with message m and backtrace\narray b as JSON string\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::Array","classes/JSON/Ext/Generator/GeneratorMethods/Array.html#method-i-to_json","(*args)","

Returns a JSON string containing a JSON array, that is generated from this\nArray instance. state is a …\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::Bignum","classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html#method-i-to_json","(*args)","

Returns a JSON string representation for this Integer number.\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::FalseClass","classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html#method-i-to_json","(*args)","

Returns a JSON string for false: ‘false’.\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::Fixnum","classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html#method-i-to_json","(*args)","

Returns a JSON string representation for this Integer number.\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::Float","classes/JSON/Ext/Generator/GeneratorMethods/Float.html#method-i-to_json","(*args)","

Returns a JSON string representation for this Float number.\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::Hash","classes/JSON/Ext/Generator/GeneratorMethods/Hash.html#method-i-to_json","(*args)","

Returns a JSON string containing a JSON object, that is generated from this\nHash instance. state is a …\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::NilClass","classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html#method-i-to_json","(*args)","

Returns a JSON string for nil: ‘null’.\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::Object","classes/JSON/Ext/Generator/GeneratorMethods/Object.html#method-i-to_json","(p1 = v1)","

Converts this object to a string (calling #to_s), converts it to a JSON\nstring, and returns the result. …\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::String","classes/JSON/Ext/Generator/GeneratorMethods/String.html#method-i-to_json","(*args)","

This string should be encoded with UTF-8 A call to this method returns a\nJSON string encoded with UTF16 …\n"],["to_json","JSON::Ext::Generator::GeneratorMethods::TrueClass","classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html#method-i-to_json","(*args)","

Returns a JSON string for true: ‘true’.\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::Array","classes/JSON/Pure/Generator/GeneratorMethods/Array.html#method-i-to_json","(state = nil, *)","

Returns a JSON string containing a JSON array, that is unparsed from this\nArray instance. state is a …\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::FalseClass","classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html#method-i-to_json","(*)","

Returns a JSON string for false: ‘false’.\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::Float","classes/JSON/Pure/Generator/GeneratorMethods/Float.html#method-i-to_json","(state = nil, *)","

Returns a JSON string representation for this Float number.\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::Hash","classes/JSON/Pure/Generator/GeneratorMethods/Hash.html#method-i-to_json","(state = nil, *)","

Returns a JSON string containing a JSON object, that is unparsed from this\nHash instance. state is a …\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::Integer","classes/JSON/Pure/Generator/GeneratorMethods/Integer.html#method-i-to_json","(*)","

Returns a JSON string representation for this Integer number.\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::NilClass","classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html#method-i-to_json","(*)","

Returns a JSON string for nil: ‘null’.\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::Object","classes/JSON/Pure/Generator/GeneratorMethods/Object.html#method-i-to_json","(*)","

Converts this object to a string (calling #to_s), converts it to a JSON\nstring, and returns the result. …\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::String","classes/JSON/Pure/Generator/GeneratorMethods/String.html#method-i-to_json","(state = nil, *args)","

This string should be encoded with UTF-8 A call to this method returns a\nJSON string encoded with UTF16 …\n"],["to_json","JSON::Pure::Generator::GeneratorMethods::TrueClass","classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html#method-i-to_json","(*)","

Returns a JSON string for true: ‘true’.\n"],["to_json","OpenStruct","classes/OpenStruct.html#method-i-to_json","(*args)","

Stores class name (OpenStruct) with this struct’s values v as\na JSON string.\n"],["to_json","Range","classes/Range.html#method-i-to_json","(*args)","

Stores class name (Range) with JSON array of arguments a which\ninclude first (integer), last (integer), …\n"],["to_json","Rational","classes/Rational.html#method-i-to_json","(*)",""],["to_json","Regexp","classes/Regexp.html#method-i-to_json","(*)","

Stores class name (Regexp) with options o and source\ns (Regexp or String) as JSON string\n"],["to_json","Struct","classes/Struct.html#method-i-to_json","(*args)","

Stores class name (Struct) with Struct values v as a JSON\nstring. Only named structs are supported.\n"],["to_json","Symbol","classes/Symbol.html#method-i-to_json","(*a)","

Stores class name (Symbol) with String representation of Symbol as a JSON\nstring.\n"],["to_json","Time","classes/Time.html#method-i-to_json","(*args)","

Stores class name (Time) with number of seconds since epoch and number of\nmicroseconds for Time as JSON …\n"],["to_json_raw","JSON::Ext::Generator::GeneratorMethods::String","classes/JSON/Ext/Generator/GeneratorMethods/String.html#method-i-to_json_raw","(*args)","

This method creates a JSON text from the result of a call to\nto_json_raw_object of this String.\n"],["to_json_raw","JSON::Pure::Generator::GeneratorMethods::String","classes/JSON/Pure/Generator/GeneratorMethods/String.html#method-i-to_json_raw","(*args)","

This method creates a JSON text from the result of a call to\nto_json_raw_object of this String.\n"],["to_json_raw_object","JSON::Ext::Generator::GeneratorMethods::String","classes/JSON/Ext/Generator/GeneratorMethods/String.html#method-i-to_json_raw_object","()","

This method creates a raw object hash, that can be nested into other data\nstructures and will be generated …\n"],["to_json_raw_object","JSON::Pure::Generator::GeneratorMethods::String","classes/JSON/Pure/Generator/GeneratorMethods/String.html#method-i-to_json_raw_object","()","

This method creates a raw object hash, that can be nested into other data\nstructures and will be unparsed …\n"],["README","","files/README_rdoc.html","","

JSON implementation for Ruby travis-ci.org/flori/json.png?branch=master\n

Description\n

This is a implementation …\n"]]}} \ No newline at end of file diff --git a/doc/js/searchdoc.js b/doc/js/searchdoc.js new file mode 100755 index 0000000..0e74220 --- /dev/null +++ b/doc/js/searchdoc.js @@ -0,0 +1,442 @@ +Searchdoc = {}; + +// navigation.js ------------------------------------------ + +Searchdoc.Navigation = new function() { + this.initNavigation = function() { + var _this = this; + + $(document).keydown(function(e) { + _this.onkeydown(e); + }).keyup(function(e) { + _this.onkeyup(e); + }); + + this.navigationActive = true; + } + + this.setNavigationActive = function(state) { + this.navigationActive = state; + this.clearMoveTimeout(); + } + + + this.onkeyup = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + case 38: //Event.KEY_UP: + case 39: //Event.KEY_RIGHT: + case 40: //Event.KEY_DOWN: + case 73: // i - qwerty + case 74: // j + case 75: // k + case 76: // l + case 67: // c - dvorak + case 72: // h + case 84: // t + case 78: // n + this.clearMoveTimeout(); + break; + } + } + + this.onkeydown = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + case 74: // j (qwerty) + case 72: // h (dvorak) + if (this.moveLeft()) e.preventDefault(); + break; + case 38: //Event.KEY_UP: + case 73: // i (qwerty) + case 67: // c (dvorak) + if (e.keyCode == 38 || e.ctrlKey) { + if (this.moveUp()) e.preventDefault(); + this.startMoveTimeout(false); + } + break; + case 39: //Event.KEY_RIGHT: + case 76: // l (qwerty) + case 78: // n (dvorak) + if (this.moveRight()) e.preventDefault(); + break; + case 40: //Event.KEY_DOWN: + case 75: // k (qwerty) + case 84: // t (dvorak) + if (e.keyCode == 40 || e.ctrlKey) { + if (this.moveDown()) e.preventDefault(); + this.startMoveTimeout(true); + } + break; + case 9: //Event.KEY_TAB: + case 13: //Event.KEY_RETURN: + if (this.$current) this.select(this.$current); + break; + } + if (e.ctrlKey && e.shiftKey) this.select(this.$current); + } + + this.clearMoveTimeout = function() { + clearTimeout(this.moveTimeout); + this.moveTimeout = null; + } + + this.startMoveTimeout = function(isDown) { + if (!$.browser.mozilla && !$.browser.opera) return; + if (this.moveTimeout) this.clearMoveTimeout(); + var _this = this; + + var go = function() { + if (!_this.moveTimeout) return; + _this[isDown ? 'moveDown' : 'moveUp'](); + _this.moveTimout = setTimeout(go, 100); + } + this.moveTimeout = setTimeout(go, 200); + } + + this.moveRight = function() { + } + + this.moveLeft = function() { + } + + this.move = function(isDown) { + } + + this.moveUp = function() { + return this.move(false); + } + + this.moveDown = function() { + return this.move(true); + } +} + + +// scrollIntoView.js -------------------------------------- + +function scrollIntoView(element, view) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = view.offsetHeight; + viewScroll = view.scrollTop; + if (offset - viewScroll + height > viewHeight) { + view.scrollTop = offset - viewHeight + height; + } + if (offset < viewScroll) { + view.scrollTop = offset; + } +} + +// panel.js ----------------------------------------------- + +Searchdoc.Panel = function(element, data, tree, frame) { + this.$element = $(element); + this.$input = $('input', element).eq(0); + this.$result = $('.result ul', element).eq(0); + this.frame = frame; + this.$current = null; + this.$view = this.$result.parent(); + this.data = data; + this.searcher = new Searcher(data.index); + + this.tree = new Searchdoc.Tree($('.tree', element), tree, this); + this.init(); +} + +Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() { + var suid = 1; + + this.init = function() { + var _this = this; + var observer = function() { + _this.search(_this.$input[0].value); + }; + this.$input.keyup(observer); + this.$input.click(observer); // mac's clear field + + this.searcher.ready(function(results, isLast) { + _this.addResults(results, isLast); + }) + + this.$result.click(function(e) { + _this.$current.removeClass('current'); + _this.$current = $(e.target).closest('li').addClass('current'); + _this.select(); + _this.$input.focus(); + }); + + this.initNavigation(); + this.setNavigationActive(false); + } + + this.search = function(value, selectFirstMatch) { + value = jQuery.trim(value).toLowerCase(); + this.selectFirstMatch = selectFirstMatch; + if (value) { + this.$element.removeClass('panel_tree').addClass('panel_results'); + this.tree.setNavigationActive(false); + this.setNavigationActive(true); + } else { + this.$element.addClass('panel_tree').removeClass('panel_results'); + this.tree.setNavigationActive(true); + this.setNavigationActive(false); + } + if (value != this.lastQuery) { + this.lastQuery = value; + this.firstRun = true; + this.searcher.find(value); + } + } + + this.addResults = function(results, isLast) { + var target = this.$result.get(0); + if (this.firstRun && (results.length > 0 || isLast)) { + this.$current = null; + this.$result.empty(); + } + for (var i=0, l = results.length; i < l; i++) { + target.appendChild(renderItem.call(this, results[i])); + }; + if (this.firstRun && results.length > 0) { + this.firstRun = false; + this.$current = $(target.firstChild); + this.$current.addClass('current'); + if (this.selectFirstMatch) this.select(); + scrollIntoView(this.$current[0], this.$view[0]) + } + if (jQuery.browser.msie) this.$element[0].className += ''; + } + + this.open = function(src) { + this.frame.location.href = '../' + src; + if (this.frame.highlight) this.frame.highlight(src); + } + + this.select = function() { + this.open(this.$current.data('path')); + } + + this.move = function(isDown) { + if (!this.$current) return; + var $next = this.$current[isDown ? 'next' : 'prev'](); + if ($next.length) { + this.$current.removeClass('current'); + $next.addClass('current'); + scrollIntoView($next[0], this.$view[0]); + this.$current = $next; + } + return true; + } + + function renderItem(result) { + var li = document.createElement('li'), + html = '', badge = result.badge; + html += '

' + hlt(result.title); + if (result.params) html += '' + result.params + ''; + html += '

'; + html += '

'; + if (typeof badge != 'undefined') { + html += '' + escapeHTML(this.data.badges[badge] || 'unknown') + ''; + } + html += hlt(result.namespace) + '

'; + if (result.snippet) html += '

' + escapeHTML(result.snippet) + '

'; + li.innerHTML = html; + jQuery.data(li, 'path', result.path); + return li; + } + + function hlt(html) { + return escapeHTML(html).replace(/\u0001/g, '').replace(/\u0002/g, '') + } + + function escapeHTML(html) { + return html.replace(/[&<>]/g, function(c) { + return '&#' + c.charCodeAt(0) + ';'; + }); + } + +}); + +// tree.js ------------------------------------------------ + +Searchdoc.Tree = function(element, tree, panel) { + this.$element = $(element); + this.$list = $('ul', element); + this.tree = tree; + this.panel = panel; + this.init(); +} + +Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() { + this.init = function() { + var stopper = document.createElement('li'); + stopper.className = 'stopper'; + this.$list[0].appendChild(stopper); + for (var i=0, l = this.tree.length; i < l; i++) { + buildAndAppendItem.call(this, this.tree[i], 0, stopper); + }; + var _this = this; + this.$list.click(function(e) { + var $target = $(e.target), + $li = $target.closest('li'); + if ($target.hasClass('icon')) { + _this.toggle($li); + } else { + _this.select($li); + } + }) + + this.initNavigation(); + if (jQuery.browser.msie) document.body.className += ''; + } + + this.select = function($li) { + this.highlight($li); + var path = $li[0].searchdoc_tree_data.path; + if (path) this.panel.open(path); + } + + this.highlight = function($li) { + if (this.$current) this.$current.removeClass('current'); + this.$current = $li.addClass('current'); + } + + this.toggle = function($li) { + var closed = !$li.hasClass('closed'), + children = $li[0].searchdoc_tree_data.children; + $li.toggleClass('closed'); + for (var i=0, l = children.length; i < l; i++) { + toggleVis.call(this, $(children[i].li), !closed); + }; + } + + this.moveRight = function() { + if (!this.$current) { + this.highlight(this.$list.find('li:first')); + return; + } + if (this.$current.hasClass('closed')) { + this.toggle(this.$current); + } + } + + this.moveLeft = function() { + if (!this.$current) { + this.highlight(this.$list.find('li:first')); + return; + } + if (!this.$current.hasClass('closed')) { + this.toggle(this.$current); + } else { + var level = this.$current[0].searchdoc_tree_data.level; + if (level == 0) return; + var $next = this.$current.prevAll('li.level_' + (level - 1) + ':visible:first'); + this.$current.removeClass('current'); + $next.addClass('current'); + scrollIntoView($next[0], this.$element[0]); + this.$current = $next; + } + } + + this.move = function(isDown) { + if (!this.$current) { + this.highlight(this.$list.find('li:first')); + return true; + } + var next = this.$current[0]; + if (isDown) { + do { + next = next.nextSibling; + if (next && next.style && next.style.display != 'none') break; + } while(next); + } else { + do { + next = next.previousSibling; + if (next && next.style && next.style.display != 'none') break; + } while(next); + } + if (next && next.className.indexOf('stopper') == -1) { + this.$current.removeClass('current'); + $(next).addClass('current'); + scrollIntoView(next, this.$element[0]); + this.$current = $(next); + } + return true; + } + + function toggleVis($li, show) { + var closed = $li.hasClass('closed'), + children = $li[0].searchdoc_tree_data.children; + $li.css('display', show ? '' : 'none') + if (!show && this.$current && $li[0] == this.$current[0]) { + this.$current.removeClass('current'); + this.$current = null; + } + for (var i=0, l = children.length; i < l; i++) { + toggleVis.call(this, $(children[i].li), show && !closed); + }; + } + + function buildAndAppendItem(item, level, before) { + var li = renderItem(item, level), + list = this.$list[0]; + item.li = li; + list.insertBefore(li, before); + for (var i=0, l = item[3].length; i < l; i++) { + buildAndAppendItem.call(this, item[3][i], level + 1, before); + }; + return li; + } + + function renderItem(item, level) { + var li = document.createElement('li'), + cnt = document.createElement('div'), + h1 = document.createElement('h1'), + p = document.createElement('p'), + icon, i; + + li.appendChild(cnt); + li.style.paddingLeft = getOffset(level); + cnt.className = 'content'; + if (!item[1]) li.className = 'empty '; + cnt.appendChild(h1); + // cnt.appendChild(p); + h1.appendChild(document.createTextNode(item[0])); + // p.appendChild(document.createTextNode(item[4])); + if (item[2]) { + i = document.createElement('i'); + i.appendChild(document.createTextNode(item[2])); + h1.appendChild(i); + } + if (item[3].length > 0) { + icon = document.createElement('div'); + icon.className = 'icon'; + cnt.appendChild(icon); + } + + // user direct assignement instead of $() + // it's 8x faster + // $(li).data('path', item[1]) + // .data('children', item[3]) + // .data('level', level) + // .css('display', level == 0 ? '' : 'none') + // .addClass('level_' + level) + // .addClass('closed'); + li.searchdoc_tree_data = { + path: item[1], + children: item[3], + level: level + } + li.style.display = level == 0 ? '' : 'none'; + li.className += 'level_' + level + ' closed'; + return li; + } + + function getOffset(level) { + return 5 + 18*level + 'px'; + } +}); diff --git a/doc/js/searcher.js b/doc/js/searcher.js new file mode 100644 index 0000000..f854b54 --- /dev/null +++ b/doc/js/searcher.js @@ -0,0 +1,228 @@ +Searcher = function(data) { + this.data = data; + this.handlers = []; +} + +Searcher.prototype = new function() { + // search is performed in chunks of 1000 for non-blocking user input + var CHUNK_SIZE = 1000; + // do not try to find more than 100 results + var MAX_RESULTS = 100; + var huid = 1; + var suid = 1; + var runs = 0; + + this.find = function(query) { + var queries = splitQuery(query); + var regexps = buildRegexps(queries); + var highlighters = buildHilighters(queries); + var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++}; + var _this = this; + + this.currentSuid = state.n; + + if (!query) return; + + var run = function() { + // stop current search thread if new search started + if (state.n != _this.currentSuid) return; + + var results = + performSearch(_this.data, regexps, queries, highlighters, state); + var hasMore = (state.limit > 0 && state.pass < 4); + + triggerResults.call(_this, results, !hasMore); + if (hasMore) { + setTimeout(run, 2); + } + runs++; + }; + runs = 0; + + // start search thread + run(); + } + + /* ----- Events ------ */ + this.ready = function(fn) { + fn.huid = huid; + this.handlers.push(fn); + } + + /* ----- Utilities ------ */ + function splitQuery(query) { + return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) { + return string.match(/\S/) + }); + } + + function buildRegexps(queries) { + return jQuery.map(queries, function(query) { + return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i') + }); + } + + function buildHilighters(queries) { + return jQuery.map(queries, function(query) { + return jQuery.map(query.split(''), function(l, i) { + return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2); + }).join(''); + }); + } + + // function longMatchRegexp(index, longIndex, regexps) { + // for (var i = regexps.length - 1; i >= 0; i--){ + // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false; + // }; + // return true; + // } + + + /* ----- Mathchers ------ */ + + /* + * This record matches if the index starts with queries[0] and the record + * matches all of the regexps + */ + function matchPassBeginning(index, longIndex, queries, regexps) { + if (index.indexOf(queries[0]) != 0) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if the longIndex starts with queries[0] and the + * longIndex matches all of the regexps + */ + function matchPassLongIndex(index, longIndex, queries, regexps) { + if (longIndex.indexOf(queries[0]) != 0) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if the index contains queries[0] and the record + * matches all of the regexps + */ + function matchPassContains(index, longIndex, queries, regexps) { + if (index.indexOf(queries[0]) == -1) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if regexps[0] matches the index and the record + * matches all of the regexps + */ + function matchPassRegexp(index, longIndex, queries, regexps) { + if (!index.match(regexps[0])) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + + /* ----- Highlighters ------ */ + function highlightRegexp(info, queries, regexps, highlighters) { + var result = createResult(info); + for (var i=0, l = regexps.length; i < l; i++) { + result.title = result.title.replace(regexps[i], highlighters[i]); + result.namespace = result.namespace.replace(regexps[i], highlighters[i]); + }; + return result; + } + + function hltSubstring(string, pos, length) { + return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length); + } + + function highlightQuery(info, queries, regexps, highlighters) { + var result = createResult(info); + var pos = 0; + var lcTitle = result.title.toLowerCase(); + + pos = lcTitle.indexOf(queries[0]); + if (pos != -1) { + result.title = hltSubstring(result.title, pos, queries[0].length); + } + + result.namespace = result.namespace.replace(regexps[0], highlighters[0]); + for (var i=1, l = regexps.length; i < l; i++) { + result.title = result.title.replace(regexps[i], highlighters[i]); + result.namespace = result.namespace.replace(regexps[i], highlighters[i]); + }; + return result; + } + + function createResult(info) { + var result = {}; + result.title = info[0]; + result.namespace = info[1]; + result.path = info[2]; + result.params = info[3]; + result.snippet = info[4]; + return result; + } + + /* ----- Searching ------ */ + function performSearch(data, regexps, queries, highlighters, state) { + var searchIndex = data.searchIndex; + var longSearchIndex = data.longSearchIndex; + var info = data.info; + var result = []; + var i = state.from; + var l = searchIndex.length; + var togo = CHUNK_SIZE; + var matchFunc, hltFunc; + + while (state.pass < 4 && state.limit > 0 && togo > 0) { + if (state.pass == 0) { + matchFunc = matchPassBeginning; + hltFunc = highlightQuery; + } else if (state.pass == 1) { + matchFunc = matchPassLongIndex; + hltFunc = highlightQuery; + } else if (state.pass == 2) { + matchFunc = matchPassContains; + hltFunc = highlightQuery; + } else if (state.pass == 3) { + matchFunc = matchPassRegexp; + hltFunc = highlightRegexp; + } + + for (; togo > 0 && i < l && state.limit > 0; i++, togo--) { + if (info[i].n == state.n) continue; + if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) { + info[i].n = state.n; + result.push(hltFunc(info[i], queries, regexps, highlighters)); + state.limit--; + } + }; + if (searchIndex.length <= i) { + state.pass++; + i = state.from = 0; + } else { + state.from = i; + } + } + return result; + } + + function triggerResults(results, isLast) { + jQuery.each(this.handlers, function(i, fn) { + fn.call(this, results, isLast) + }) + } +} + diff --git a/doc/panel/index.html b/doc/panel/index.html new file mode 100755 index 0000000..fc53d95 --- /dev/null +++ b/doc/panel/index.html @@ -0,0 +1,73 @@ + + + + + + search index + + + + + + + + + + +
+
+
+ + + +
+ +
+
+
+
    +
+
+
+
    +
+
+
+ index + + diff --git a/doc/panel/links.html b/doc/panel/links.html new file mode 100644 index 0000000..d926142 --- /dev/null +++ b/doc/panel/links.html @@ -0,0 +1,52 @@ + + File index + + + README.rdoc + + ext/json/ext/generator/generator.c + + ext/json/ext/parser/parser.c + + lib/json.rb + + lib/json/add/bigdecimal.rb + + lib/json/add/complex.rb + + lib/json/add/core.rb + + lib/json/add/date.rb + + lib/json/add/date_time.rb + + lib/json/add/exception.rb + + lib/json/add/ostruct.rb + + lib/json/add/range.rb + + lib/json/add/rational.rb + + lib/json/add/regexp.rb + + lib/json/add/struct.rb + + lib/json/add/symbol.rb + + lib/json/add/time.rb + + lib/json/common.rb + + lib/json/ext.rb + + lib/json/pure.rb + + lib/json/pure/generator.rb + + lib/json/pure/parser.rb + + lib/json/version.rb + + + \ No newline at end of file diff --git a/doc/panel/tree.js b/doc/panel/tree.js new file mode 100644 index 0000000..71eb1f9 --- /dev/null +++ b/doc/panel/tree.js @@ -0,0 +1 @@ +var tree = [["","","files",[["README.rdoc","files/README_rdoc.html","",[]],["","","ext",[["","","json",[["","","ext",[["","","generator",[["generator.c","files/ext/json/ext/generator/generator_c.html","",[]]]],["","","parser",[["parser.c","files/ext/json/ext/parser/parser_c.html","",[]]]]]]]]]],["","","lib",[["","","json",[["","","add",[["bigdecimal.rb","files/lib/json/add/bigdecimal_rb.html","",[]],["complex.rb","files/lib/json/add/complex_rb.html","",[]],["core.rb","files/lib/json/add/core_rb.html","",[]],["date.rb","files/lib/json/add/date_rb.html","",[]],["date_time.rb","files/lib/json/add/date_time_rb.html","",[]],["exception.rb","files/lib/json/add/exception_rb.html","",[]],["ostruct.rb","files/lib/json/add/ostruct_rb.html","",[]],["range.rb","files/lib/json/add/range_rb.html","",[]],["rational.rb","files/lib/json/add/rational_rb.html","",[]],["regexp.rb","files/lib/json/add/regexp_rb.html","",[]],["struct.rb","files/lib/json/add/struct_rb.html","",[]],["symbol.rb","files/lib/json/add/symbol_rb.html","",[]],["time.rb","files/lib/json/add/time_rb.html","",[]]]],["common.rb","files/lib/json/common_rb.html","",[]],["ext.rb","files/lib/json/ext_rb.html","",[]],["","","pure",[["generator.rb","files/lib/json/pure/generator_rb.html","",[]],["parser.rb","files/lib/json/pure/parser_rb.html","",[]]]],["pure.rb","files/lib/json/pure_rb.html","",[]],["version.rb","files/lib/json/version_rb.html","",[]]]],["json.rb","files/lib/json_rb.html","",[]]]]]],["BigDecimal","classes/BigDecimal.html"," < Object",[]],["Class","classes/Class.html"," < Object",[]],["Complex","classes/Complex.html"," < Object",[]],["Date","classes/Date.html"," < Object",[]],["DateTime","classes/DateTime.html"," < Object",[]],["Exception","classes/Exception.html"," < Object",[]],["JSON","classes/JSON.html","",[["CircularDatastructure","classes/JSON/CircularDatastructure.html"," < JSON::NestingError",[]],["Ext","classes/JSON/Ext.html","",[["Generator","classes/JSON/Ext/Generator.html","",[["GeneratorMethods","classes/JSON/Ext/Generator/GeneratorMethods.html","",[["Array","classes/JSON/Ext/Generator/GeneratorMethods/Array.html","",[]],["Bignum","classes/JSON/Ext/Generator/GeneratorMethods/Bignum.html","",[]],["FalseClass","classes/JSON/Ext/Generator/GeneratorMethods/FalseClass.html","",[]],["Fixnum","classes/JSON/Ext/Generator/GeneratorMethods/Fixnum.html","",[]],["Float","classes/JSON/Ext/Generator/GeneratorMethods/Float.html","",[]],["Hash","classes/JSON/Ext/Generator/GeneratorMethods/Hash.html","",[]],["NilClass","classes/JSON/Ext/Generator/GeneratorMethods/NilClass.html","",[]],["Object","classes/JSON/Ext/Generator/GeneratorMethods/Object.html","",[]],["String","classes/JSON/Ext/Generator/GeneratorMethods/String.html","",[["Extend","classes/JSON/Ext/Generator/GeneratorMethods/String/Extend.html","",[]]]],["TrueClass","classes/JSON/Ext/Generator/GeneratorMethods/TrueClass.html","",[]]]],["State","classes/JSON/Ext/Generator/State.html"," < Object",[]]]],["Parser","classes/JSON/Ext/Parser.html"," < Object",[]]]],["GeneratorError","classes/JSON/GeneratorError.html"," < JSON::JSONError",[]],["JSONError","classes/JSON/JSONError.html"," < StandardError",[]],["MissingUnicodeSupport","classes/JSON/MissingUnicodeSupport.html"," < JSON::JSONError",[]],["NestingError","classes/JSON/NestingError.html"," < JSON::ParserError",[]],["ParserError","classes/JSON/ParserError.html"," < JSON::JSONError",[]],["Pure","classes/JSON/Pure.html","",[["Generator","classes/JSON/Pure/Generator.html","",[["GeneratorMethods","classes/JSON/Pure/Generator/GeneratorMethods.html","",[["Array","classes/JSON/Pure/Generator/GeneratorMethods/Array.html","",[]],["FalseClass","classes/JSON/Pure/Generator/GeneratorMethods/FalseClass.html","",[]],["Float","classes/JSON/Pure/Generator/GeneratorMethods/Float.html","",[]],["Hash","classes/JSON/Pure/Generator/GeneratorMethods/Hash.html","",[]],["Integer","classes/JSON/Pure/Generator/GeneratorMethods/Integer.html","",[]],["NilClass","classes/JSON/Pure/Generator/GeneratorMethods/NilClass.html","",[]],["Object","classes/JSON/Pure/Generator/GeneratorMethods/Object.html","",[]],["String","classes/JSON/Pure/Generator/GeneratorMethods/String.html","",[["Extend","classes/JSON/Pure/Generator/GeneratorMethods/String/Extend.html","",[]]]],["TrueClass","classes/JSON/Pure/Generator/GeneratorMethods/TrueClass.html","",[]]]],["State","classes/JSON/Pure/Generator/State.html"," < Object",[]]]],["Parser","classes/JSON/Pure/Parser.html"," < StringScanner",[]]]],["UnparserError","classes/JSON/GeneratorError.html"," < JSON::JSONError",[]]]],["Kernel","classes/Kernel.html","",[]],["OpenStruct","classes/OpenStruct.html"," < Object",[]],["Range","classes/Range.html"," < Object",[]],["Rational","classes/Rational.html"," < Object",[]],["Regexp","classes/Regexp.html"," < Object",[]],["Struct","classes/Struct.html"," < Object",[]],["Symbol","classes/Symbol.html"," < Object",[]],["Time","classes/Time.html"," < Object",[]]] \ No newline at end of file -- cgit v1.2.1