D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby18
/
lib64
/
ruby
/
gems
/
1.8
/
doc
/
rack-1.6.1
/
rdoc
/
classes
/
Rack
/
Utils
/
Filename :
OkJson.html
back
Copy
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Module: Rack::Utils::OkJson</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Module</strong></td> <td class="class-name-in-header">Rack::Utils::OkJson</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../../files/lib/rack/utils/okjson_rb.html"> lib/rack/utils/okjson.rb </a> <br /> </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> Some parts adapted from <a href="https://golang.org/src/encoding/json/decode.go">golang.org/src/encoding/json/decode.go</a> and <a href="https://golang.org/src/unicode/utf8/utf8.go">golang.org/src/unicode/utf8/utf8.go</a> </p> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000052">decode</a> <a href="#M000053">encode</a> <a href="#M000054">valenc</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="class-list"> <h3 class="section-bar">Classes and Modules</h3> Class <a href="OkJson/Error.html" class="link">Rack::Utils::OkJson::Error</a><br /> Class <a href="OkJson/Utf8Error.html" class="link">Rack::Utils::OkJson::Utf8Error</a><br /> </div> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">Upstream</td> <td>=</td> <td class="context-item-value">'43'</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Utagx</td> <td>=</td> <td class="context-item-value">0b1000_0000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Utag2</td> <td>=</td> <td class="context-item-value">0b1100_0000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Utag3</td> <td>=</td> <td class="context-item-value">0b1110_0000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Utag4</td> <td>=</td> <td class="context-item-value">0b1111_0000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Utag5</td> <td>=</td> <td class="context-item-value">0b1111_1000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Umaskx</td> <td>=</td> <td class="context-item-value">0b0011_1111</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Umask2</td> <td>=</td> <td class="context-item-value">0b0001_1111</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Umask3</td> <td>=</td> <td class="context-item-value">0b0000_1111</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Umask4</td> <td>=</td> <td class="context-item-value">0b0000_0111</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Uchar1max</td> <td>=</td> <td class="context-item-value">(1<<7) - 1</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Uchar2max</td> <td>=</td> <td class="context-item-value">(1<<11) - 1</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Uchar3max</td> <td>=</td> <td class="context-item-value">(1<<16) - 1</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Ucharerr</td> <td>=</td> <td class="context-item-value">0xFFFD</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Ustrerr</td> <td>=</td> <td class="context-item-value">"\xef\xbf\xbd"</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Usurrself</td> <td>=</td> <td class="context-item-value">0x10000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Usurr1</td> <td>=</td> <td class="context-item-value">0xd800</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Usurr2</td> <td>=</td> <td class="context-item-value">0xdc00</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Usurr3</td> <td>=</td> <td class="context-item-value">0xe000</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Spc</td> <td>=</td> <td class="context-item-value">' '[0]</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">Unesc</td> <td>=</td> <td class="context-item-value">{?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t}</td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000052" class="method-detail"> <a name="M000052"></a> <div class="method-heading"> <a href="OkJson.src/M000052.html" target="Code" class="method-signature" onclick="popupCode('OkJson.src/M000052.html');return false;"> <span class="method-name">decode</span><span class="method-args">(s)</span> </a> </div> <div class="method-description"> <p> Decodes a json document in string s and returns the corresponding ruby value. String s must be valid UTF-8. If you have a string in some other encoding, convert it first. </p> <p> String values in the resulting structure will be UTF-8. </p> </div> </div> <div id="method-M000053" class="method-detail"> <a name="M000053"></a> <div class="method-heading"> <a href="OkJson.src/M000053.html" target="Code" class="method-signature" onclick="popupCode('OkJson.src/M000053.html');return false;"> <span class="method-name">encode</span><span class="method-args">(x)</span> </a> </div> <div class="method-description"> <p> Encodes x into a json text. It may contain only Array, Hash, String, Numeric, true, false, nil. (Note, this list excludes Symbol.) X itself must be an Array or a Hash. No other value can be encoded, and an error will be raised if x contains any other value, such as Nan, Infinity, Symbol, and Proc, or if a Hash key is not a String. Strings contained in x must be valid UTF-8. </p> </div> </div> <div id="method-M000054" class="method-detail"> <a name="M000054"></a> <div class="method-heading"> <a href="OkJson.src/M000054.html" target="Code" class="method-signature" onclick="popupCode('OkJson.src/M000054.html');return false;"> <span class="method-name">valenc</span><span class="method-args">(x)</span> </a> </div> <div class="method-description"> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>