doc/classes/SDL4R.html in sdl4r-0.9.6 vs doc/classes/SDL4R.html in sdl4r-0.9.7
- old
+ new
@@ -1,681 +1,393 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!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: SDL4R</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <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">SDL4R</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../files/lib/sdl4r/sdl_time_span_rb.html">
- lib/sdl4r/sdl_time_span.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/sdl_parse_error_rb.html">
- lib/sdl4r/sdl_parse_error.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/tag_rb.html">
- lib/sdl4r/tag.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/parser_rb.html">
- lib/sdl4r/parser.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/sdl_binary_rb.html">
- lib/sdl4r/sdl_binary.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/parser/reader_rb.html">
- lib/sdl4r/parser/reader.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/parser/tokenizer_rb.html">
- lib/sdl4r/parser/tokenizer.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/parser/token_rb.html">
- lib/sdl4r/parser/token.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/parser/time_span_with_zone_rb.html">
- lib/sdl4r/parser/time_span_with_zone.rb
- </a>
- <br />
- <a href="../files/lib/sdl4r/sdl4r_rb.html">
- lib/sdl4r/sdl4r.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
- <div id="description">
- <p>
-Gathers utility methods.
-</p>
-
- </div>
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000001">SdlBinary</a>
- <a href="#M000004">coerce_or_fail</a>
- <a href="#M000002">format</a>
- <a href="#M000003">new_date_time</a>
- <a href="#M000006">read</a>
- <a href="#M000009">to_attribute_map</a>
- <a href="#M000007">to_value</a>
- <a href="#M000008">to_value_array</a>
- <a href="#M000005">validate_identifier</a>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html lang='en'>
+ <head>
+ <title>: SDL4R [RDoc: Simple Declarative Language for Ruby]</title>
+ <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
+ <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
+ <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) {
+ var code = document.getElementById(id)
+
+ code.style.display = code.style.display != 'block' ? 'block' : 'none'
+ return true
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
+ //]]>
+ </script>
+ </head>
+ <body class='page'>
+ <div class='class' id='wrapper'>
+ <div class='header'>
+ <h1 class='name'>
+ <span class='type'>Module</span>
+ SDL4R
+ </h1>
+ <ol class='paths'>
+ <li>
+ <a href="../files/lib/sdl4r/sdl_time_span_rb.html">lib/sdl4r/sdl_time_span.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/sdl_parse_error_rb.html">lib/sdl4r/sdl_parse_error.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/tag_rb.html">lib/sdl4r/tag.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/parser_rb.html">lib/sdl4r/parser.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/sdl_binary_rb.html">lib/sdl4r/sdl_binary.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/parser/reader_rb.html">lib/sdl4r/parser/reader.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/parser/tokenizer_rb.html">lib/sdl4r/parser/tokenizer.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/parser/token_rb.html">lib/sdl4r/parser/token.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/sdl4r_rb.html">lib/sdl4r/sdl4r.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/lib/sdl4r/parser/time_span_with_zone_rb.html">lib/sdl4r/parser/time_span_with_zone.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/test/sdl4r/parser_test_rb.html">test/sdl4r/parser_test.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/test/sdl4r/tag_test_rb.html">test/sdl4r/tag_test.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/test/sdl4r/sdl_test_rb.html">test/sdl4r/sdl_test.rb</a>
+ </li>
+ <li class='other'>
+ <a href="../files/test/sdl4r/sdl4r_test_rb.html">test/sdl4r/sdl4r_test.rb</a>
+ </li>
+ <li>
+ <a class='show' href='#' onclick='this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false'>show all</a>
+ </li>
+ </ol>
</div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
-
- <div id="section">
-
- <div id="class-list">
- <h3 class="section-bar">Classes and Modules</h3>
-
- Class <a href="SDL4R/Parser.html" class="link">SDL4R::Parser</a><br />
-Class <a href="SDL4R/SdlBinary.html" class="link">SDL4R::SdlBinary</a><br />
-Class <a href="SDL4R/SdlParseError.html" class="link">SDL4R::SdlParseError</a><br />
-Class <a href="SDL4R/SdlTimeSpan.html" class="link">SDL4R::SdlTimeSpan</a><br />
-Class <a href="SDL4R/Tag.html" class="link">SDL4R::Tag</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">MAX_INTEGER_32</td>
- <td>=</td>
- <td class="context-item-value">2**31 - 1</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">MIN_INTEGER_32</td>
- <td>=</td>
- <td class="context-item-value">-(2**31)</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">MAX_INTEGER_64</td>
- <td>=</td>
- <td class="context-item-value">2**63 - 1</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">MIN_INTEGER_64</td>
- <td>=</td>
- <td class="context-item-value">-(2**63)</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">BASE64_WRAP_LINE_LENGTH</td>
- <td>=</td>
- <td class="context-item-value">72</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">ESCAPED_QUOTES</td>
- <td>=</td>
- <td class="context-item-value">{ "\"" => "\\\"", "'" => "\\'", "`" => "\\`", }</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">ESCAPED_CHARS</td>
- <td>=</td>
- <td class="context-item-value">{ "\\" => "\\\\", "\t" => "\\t", "\r" => "\\r", "\n" => "\\n", }</td>
- </tr>
- </table>
- </div>
- </div>
-
-
-
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Class methods</h3>
-
- <div id="method-M000001" class="method-detail">
- <a name="M000001"></a>
-
- <div class="method-heading">
- <a href="#M000001" class="method-signature">
- <span class="method-name">SdlBinary</span><span class="method-args">(o)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Try to coerce ‘o’ into a <a
-href="SDL4R.html#M000001">SdlBinary</a>. Raise an ArgumentError if it
-fails.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000001-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 72</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">SdlBinary</span>(<span class="ruby-identifier">o</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">SdlBinary</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">String</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-constant">SdlBinary</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">o</span>)
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"can't coerce argument"</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
+ <div id='content'>
+ <div id='text'>
+ <div id='description'>
+ <hr size="1"></hr><p>
+ Gathers utility methods.
+ </p>
+ <hr size="1"></hr>
</div>
- </div>
- </div>
-
- <div id="method-M000004" class="method-detail">
- <a name="M000004"></a>
-
- <div class="method-heading">
- <a href="#M000004" class="method-signature">
- <span class="method-name">coerce_or_fail</span><span class="method-args">(o)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Coerce the type to a standard SDL type or raises an ArgumentError.
-</p>
-<p>
-Returns <tt>o</tt> if of the following classes: NilClass, String, Numeric,
-Float, TrueClass, FalseClass, Date, DateTime, Time, <a
-href="SDL4R/SdlTimeSpan.html">SdlTimeSpan</a>, <a
-href="SDL4R.html#M000001">SdlBinary</a>,
-</p>
-<p>
-Rationals are turned into Floats using Rational#to_f.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000004-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 151</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">coerce_or_fail</span>(<span class="ruby-identifier">o</span>)
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">o</span>
-
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Rational</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_f</span>
-
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">NilClass</span>,
- <span class="ruby-constant">String</span>,
- <span class="ruby-constant">Numeric</span>,
- <span class="ruby-constant">Float</span>,
- <span class="ruby-constant">TrueClass</span>,
- <span class="ruby-constant">FalseClass</span>,
- <span class="ruby-constant">Date</span>,
- <span class="ruby-constant">DateTime</span>,
- <span class="ruby-constant">Time</span>,
- <span class="ruby-constant">SdlTimeSpan</span>,
- <span class="ruby-constant">SdlBinary</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>
-
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"#{o.class.name} is not coercible to an SDL type"</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
+ <div id='method-list'>
+ <h2>Methods</h2>
+ <h3>public class</h3>
+ <ol>
+ <li><a href="#M000001">SdlBinary</a></li>
+ <li><a href="#M000004">coerce_or_fail</a></li>
+ <li><a href="#M000002">format</a></li>
+ <li><a href="#M000003">new_date_time</a></li>
+ <li><a href="#M000006">read</a></li>
+ <li><a href="#M000009">to_attribute_map</a></li>
+ <li><a href="#M000007">to_value</a></li>
+ <li><a href="#M000008">to_value_array</a></li>
+ <li><a href="#M000005">validate_identifier</a></li>
+ </ol>
</div>
- </div>
- </div>
-
- <div id="method-M000002" class="method-detail">
- <a name="M000002"></a>
-
- <div class="method-heading">
- <a href="#M000002" class="method-signature">
- <span class="method-name">format</span><span class="method-args">(o, add_quotes = true, line_prefix = "", indent = "\t")</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Creates an SDL string representation for a given object and returns it.
-</p>
-<table>
-<tr><td valign="top"><tt>o</tt>:</td><td>the object to <a href="SDL4R.html#M000002">format</a>
-
-</td></tr>
-<tr><td valign="top"><tt>add_quotes</tt>:</td><td>indicates whether quotes will be added to Strings and characters (true by
-default)
-
-</td></tr>
-<tr><td valign="top"><tt>line_prefix</tt>:</td><td>the line prefix to use ("" by default)
-
-</td></tr>
-<tr><td valign="top"><tt>indent</tt>:</td><td>the indent string to use ("\t" by default)
-
-</td></tr>
-</table>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000002-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 44</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">o</span>, <span class="ruby-identifier">add_quotes</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">line_prefix</span> = <span class="ruby-value str">""</span>, <span class="ruby-identifier">indent</span> = <span class="ruby-value str">"\t"</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">add_quotes</span>
- <span class="ruby-identifier">o_length</span> = <span class="ruby-value">0</span>
- <span class="ruby-identifier">o</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/./</span><span class="ruby-identifier">m</span>) { <span class="ruby-identifier">o_length</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> } <span class="ruby-comment cmt"># counts the number of chars (as opposed of bytes)</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o_length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"'"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">o</span>, <span class="ruby-value str">"'"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"'"</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'"'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">o</span>, <span class="ruby-value str">'"'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'"'</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">o</span>)
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Bignum</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"BD"</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-constant">MIN_INTEGER_32</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">o</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">o</span> <span class="ruby-operator"><=</span> <span class="ruby-constant">MAX_INTEGER_32</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">MIN_INTEGER_64</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">o</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">o</span> <span class="ruby-operator"><=</span> <span class="ruby-constant">MAX_INTEGER_64</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"L"</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"BD"</span>
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Float</span>)
- <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"F"</span>)
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Rational</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_f</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"F"</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">BigDecimal</span>)
- <span class="ruby-identifier">s</span> = <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value str">'F'</span>)
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\.0$/</span>, <span class="ruby-value str">""</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{s}BD"</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">nil?</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"null"</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SdlBinary</span>)
- <span class="ruby-identifier">encoded_o</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">o</span>.<span class="ruby-identifier">bytes</span>)
- <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n]/</span><span class="ruby-identifier">m</span>, <span class="ruby-value str">""</span>) <span class="ruby-comment cmt"># Remove the EOL inserted every 60 chars</span>
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">add_quotes</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-constant">BASE64_WRAP_LINE_LENGTH</span>
- <span class="ruby-comment cmt"># FIXME: we should a constant or some parameter instead of hardcoded spaces</span>
- <span class="ruby-identifier">wrap_lines_in_ascii</span>(<span class="ruby-identifier">encoded_o</span>, <span class="ruby-constant">BASE64_WRAP_LINE_LENGTH</span>, <span class="ruby-node">"#{line_prefix}#{indent}"</span>)
- <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-node">"[#{$/}"</span>)
- <span class="ruby-identifier">encoded_o</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{$/}#{line_prefix}]"</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-value str">"["</span>)
- <span class="ruby-identifier">encoded_o</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"]"</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">encoded_o</span>
-
- <span class="ruby-comment cmt"># Below, we use "#{o.year}" instead of "%Y" because "%Y" always emit 4 chars at least even if</span>
- <span class="ruby-comment cmt"># the date is before 1000.</span>
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DateTime</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Time</span>)
- <span class="ruby-identifier">milliseconds</span> = <span class="ruby-identifier">get_datetime_milliseconds</span>(<span class="ruby-identifier">o</span>)
-
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">milliseconds</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">zone</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S%Z"</span>)
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S"</span>)
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">zone</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S."</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">milliseconds</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-value">3</span>, <span class="ruby-value str">'0'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"%Z"</span>)
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S."</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">milliseconds</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-value">3</span>, <span class="ruby-value str">'0'</span>))
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Date</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d"</span>)
-
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
+ <div id='section'>
+ <div id='class-list'>
+ <h2>Classes and Modules</h2>
+ Class <a href="SDL4R/Parser.html" class="link">SDL4R::Parser</a><br />
+ Class <a href="SDL4R/ParserTest.html" class="link">SDL4R::ParserTest</a><br />
+ Class <a href="SDL4R/SDL4RTest.html" class="link">SDL4R::SDL4RTest</a><br />
+ Class <a href="SDL4R/SDLTest.html" class="link">SDL4R::SDLTest</a><br />
+ Class <a href="SDL4R/SdlBinary.html" class="link">SDL4R::SdlBinary</a><br />
+ Class <a href="SDL4R/SdlParseError.html" class="link">SDL4R::SdlParseError</a><br />
+ Class <a href="SDL4R/SdlTimeSpan.html" class="link">SDL4R::SdlTimeSpan</a><br />
+ Class <a href="SDL4R/Tag.html" class="link">SDL4R::Tag</a><br />
+ Class <a href="SDL4R/TagTest.html" class="link">SDL4R::TagTest</a><br />
+ </div>
+ <div id='constants-list'>
+ <h2>Constants</h2>
+ <div class='name-list'>
+ <table summary='Constants'>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>MAX_INTEGER_32</td>
+ <td>=</td>
+ <td class='context-item-value'>2**31 - 1</td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>MIN_INTEGER_32</td>
+ <td>=</td>
+ <td class='context-item-value'>-(2**31)</td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>MAX_INTEGER_64</td>
+ <td>=</td>
+ <td class='context-item-value'>2**63 - 1</td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>MIN_INTEGER_64</td>
+ <td>=</td>
+ <td class='context-item-value'>-(2**63)</td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>BASE64_WRAP_LINE_LENGTH</td>
+ <td>=</td>
+ <td class='context-item-value'>72</td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>ESCAPED_QUOTES</td>
+ <td>=</td>
+ <td class='context-item-value'>{ "\"" => "\\\"", "'" => "\\'", "`" => "\\`", }</td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>ESCAPED_CHARS</td>
+ <td>=</td>
+ <td class='context-item-value'>{ "\\" => "\\\\", "\t" => "\\t", "\r" => "\\r", "\n" => "\\n", }</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <div id='methods'>
+ <h2>Public class methods</h2>
+ <div class='method public-class' id='method-M000001'>
+ <a name='M000001'></a>
+ <div class='synopsis'>
+ <span class='name'>SdlBinary</span>
+ <span class='arguments'>(o)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Try to coerce ‘o’ into a <a
+ href="SDL4R.html#M000001">SdlBinary</a>. Raise an ArgumentError if it
+ fails.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000001-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 72</span>
72: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">SdlBinary</span>(<span class="ruby-identifier">o</span>)
73: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">SdlBinary</span>
74: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>
75: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">String</span>
76: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">SdlBinary</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">o</span>)
77: <span class="ruby-keyword kw">else</span>
78: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"can't coerce argument"</span>
79: <span class="ruby-keyword kw">end</span>
80: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000004'>
+ <a name='M000004'></a>
+ <div class='synopsis'>
+ <span class='name'>coerce_or_fail</span>
+ <span class='arguments'>(o)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Coerce the type to a standard SDL type or raises an ArgumentError.
+ </p>
+ <p>
+ Returns <tt>o</tt> if of the following classes: NilClass, String, Numeric,
+ Float, TrueClass, FalseClass, Date, DateTime, Time, <a
+ href="SDL4R/SdlTimeSpan.html">SdlTimeSpan</a>, <a
+ href="SDL4R.html#M000001">SdlBinary</a>,
+ </p>
+ <p>
+ Rationals are turned into Floats using Rational#to_f.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 151</span>
151: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">coerce_or_fail</span>(<span class="ruby-identifier">o</span>)
152: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">o</span>
153: 
154: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Rational</span>
155: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_f</span>
156: 
157: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">NilClass</span>,
158: <span class="ruby-constant">String</span>,
159: <span class="ruby-constant">Numeric</span>,
160: <span class="ruby-constant">Float</span>,
161: <span class="ruby-constant">TrueClass</span>,
162: <span class="ruby-constant">FalseClass</span>,
163: <span class="ruby-constant">Date</span>,
164: <span class="ruby-constant">DateTime</span>,
165: <span class="ruby-constant">Time</span>,
166: <span class="ruby-constant">SdlTimeSpan</span>,
167: <span class="ruby-constant">SdlBinary</span>
168: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>
169: 
170: <span class="ruby-keyword kw">end</span>
171: 
172: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"#{o.class.name} is not coercible to an SDL type"</span>
173: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000002'>
+ <a name='M000002'></a>
+ <div class='synopsis'>
+ <span class='name'>format</span>
+ <span class='arguments'>(o, add_quotes = true, line_prefix = "", indent = "\t")</span>
+ </div>
+ <div class='description'>
+ <p>
+ Creates an SDL string representation for a given object and returns it.
+ </p>
+ <table>
+ <tr><td valign="top"><tt>o</tt>:</td><td>the object to format
+
+ </td></tr>
+ <tr><td valign="top"><tt>add_quotes</tt>:</td><td>indicates whether quotes will be added to Strings and characters (true by
+ default)
+
+ </td></tr>
+ <tr><td valign="top"><tt>line_prefix</tt>:</td><td>the line prefix to use (“” by default)
+
+ </td></tr>
+ <tr><td valign="top"><tt>indent</tt>:</td><td>the indent string to use (“t“ by default)
+
+ </td></tr>
+ </table>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 44</span>
 44: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">o</span>, <span class="ruby-identifier">add_quotes</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">line_prefix</span> = <span class="ruby-value str">""</span>, <span class="ruby-identifier">indent</span> = <span class="ruby-value str">"\t"</span>)
 45: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
 46: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">add_quotes</span>
 47: <span class="ruby-identifier">o_length</span> = <span class="ruby-value">0</span>
 48: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/./</span><span class="ruby-identifier">m</span>) { <span class="ruby-identifier">o_length</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> } <span class="ruby-comment cmt"># counts the number of chars (as opposed of bytes)</span>
 49: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o_length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
 50: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"'"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">o</span>, <span class="ruby-value str">"'"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"'"</span>
 51: <span class="ruby-keyword kw">else</span>
 52: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'"'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">o</span>, <span class="ruby-value str">'"'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'"'</span>
 53: <span class="ruby-keyword kw">end</span>
 54: <span class="ruby-keyword kw">else</span>
 55: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">o</span>)
 56: <span class="ruby-keyword kw">end</span>
 57: 
 58: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Bignum</span>)
 59: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"BD"</span>
 60: 
 61: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>)
 62: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">MIN_INTEGER_32</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">o</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">o</span> <span class="ruby-operator"><=</span> <span class="ruby-constant">MAX_INTEGER_32</span>
 63: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>
 64: <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">MIN_INTEGER_64</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">o</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">o</span> <span class="ruby-operator"><=</span> <span class="ruby-constant">MAX_INTEGER_64</span>
 65: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"L"</span>
 66: <span class="ruby-keyword kw">else</span>
 67: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"BD"</span>
 68: <span class="ruby-keyword kw">end</span>
 69: 
 70: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Float</span>)
 71: <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"F"</span>)
 72: 
 73: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Rational</span>)
 74: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_f</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"F"</span>
 75: 
 76: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">BigDecimal</span>)
 77: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value str">'F'</span>)
 78: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\.0$/</span>, <span class="ruby-value str">""</span>)
 79: <span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{s}BD"</span>
 80: 
 81: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">nil?</span>
 82: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"null"</span>
 83: 
 84: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SdlBinary</span>)
 85: <span class="ruby-identifier">encoded_o</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">o</span>.<span class="ruby-identifier">bytes</span>)
 86: <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n]/</span><span class="ruby-identifier">m</span>, <span class="ruby-value str">""</span>) <span class="ruby-comment cmt"># Remove the EOL inserted every 60 chars</span>
 87: 
 88: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">add_quotes</span>
 89: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-constant">BASE64_WRAP_LINE_LENGTH</span>
 90: <span class="ruby-comment cmt"># FIXME: we should a constant or some parameter instead of hardcoded spaces</span>
 91: <span class="ruby-identifier">wrap_lines_in_ascii</span>(<span class="ruby-identifier">encoded_o</span>, <span class="ruby-constant">BASE64_WRAP_LINE_LENGTH</span>, <span class="ruby-node">"#{line_prefix}#{indent}"</span>)
 92: <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-node">"[#{$/}"</span>)
 93: <span class="ruby-identifier">encoded_o</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{$/}#{line_prefix}]"</span>
 94: <span class="ruby-keyword kw">else</span>
 95: <span class="ruby-identifier">encoded_o</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-value str">"["</span>)
 96: <span class="ruby-identifier">encoded_o</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"]"</span>
 97: <span class="ruby-keyword kw">end</span>
 98: <span class="ruby-keyword kw">end</span>
 99: 
100: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">encoded_o</span>
101: 
102: <span class="ruby-comment cmt"># Below, we use "#{o.year}" instead of "%Y" because "%Y" always emit 4 chars at least even if</span>
103: <span class="ruby-comment cmt"># the date is before 1000.</span>
104: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DateTime</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Time</span>)
105: <span class="ruby-identifier">milliseconds</span> = <span class="ruby-identifier">get_datetime_milliseconds</span>(<span class="ruby-identifier">o</span>)
106: 
107: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">milliseconds</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
108: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">zone</span>
109: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S%Z"</span>)
110: <span class="ruby-keyword kw">else</span>
111: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S"</span>)
112: <span class="ruby-keyword kw">end</span>
113: <span class="ruby-keyword kw">else</span>
114: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">zone</span>
115: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S."</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">milliseconds</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-value">3</span>, <span class="ruby-value str">'0'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"%Z"</span>)
116: <span class="ruby-keyword kw">else</span>
117: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d %H:%M:%S."</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">milliseconds</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-value">3</span>, <span class="ruby-value str">'0'</span>))
118: <span class="ruby-keyword kw">end</span>
119: <span class="ruby-keyword kw">end</span>
120: 
121: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Date</span>)
122: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">"#{o.year}/%m/%d"</span>)
123: 
124: <span class="ruby-keyword kw">else</span>
125: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>
126: <span class="ruby-keyword kw">end</span>
127: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000003'>
+ <a name='M000003'></a>
+ <div class='synopsis'>
+ <span class='name'>new_date_time</span>
+ <span class='arguments'>(year, month, day, hour, min, sec, time_zone_offset)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Creates and returns the object representing a datetime (DateTime in the
+ default implementation). This method is, by default, called by the <a
+ href="SDL4R/Parser.html">Parser</a> class. It could be overriden as follows
+ in order to get Time instances from all the <a href="SDL4R.html">SDL4R</a>
+ parsers.
+ </p>
+ <pre>module SDL4R
 def self.new_date_time(year, month, day, hour, min, sec, time_zone_offset)
 Time.utc(year, month, day, hour, min, sec)
 end
end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 139</span>
139: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
140: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
141: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000006'>
+ <a name='M000006'></a>
+ <div class='synopsis'>
+ <span class='name'>read</span>
+ <span class='arguments'>(input)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Creates and returns a tag named “root” and add all the tags
+ specified in the given <tt>input</tt>.
+ </p>
+ <table>
+ <tr><td valign="top"><tt>input</tt>:</td><td>String, IO, Pathname or URI.
+
+ </td></tr>
+ </table>
+ <pre>root = SDL4R::read(<<EOF
planets {
 earth area_km2=510900000
 mars
}
EOF
)

root = SDL4R::read(Pathname.new("my_dir/my_file.sdl"))

IO.open("my_dir/my_file.sdl", "r") { |io|
 root = SDL4R::read(io)
}

root = SDL4R::read(URI.new("http://my_site/my_file.sdl"))</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 232</span>
232: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">input</span>)
233: <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"root"</span>).<span class="ruby-identifier">read</span>(<span class="ruby-identifier">input</span>)
234: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000009'>
+ <a name='M000009'></a>
+ <div class='synopsis'>
+ <span class='name'>to_attribute_map</span>
+ <span class='arguments'>(s)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Parse a string representing the attributes portion of an SDL tag and return
+ the results as a map.
+ </p>
+ <p>
+ Example
+ </p>
+ <pre>hash = SDL4R.to_attribute_hash("value=1 debugging=on time=12:24:01");

# { "value" => 1, "debugging" => true, "time" => SdlTimeSpan.new(12, 24, 01) }</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 270</span>
270: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_attribute_map</span>(<span class="ruby-identifier">s</span>)
271: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"'s' cannot be null"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
272: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-value str">"atts "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">attributes</span>
273: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000007'>
+ <a name='M000007'></a>
+ <div class='synopsis'>
+ <span class='name'>to_value</span>
+ <span class='arguments'>(s)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Parses and returns the value corresponding with the specified SDL literal.
+ </p>
+ <pre>SDL4R.to_value("\"abcd\"") # => "abcd"
SDL4R.to_value("1") # => 1
SDL4R.to_value("null") # => nil</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 242</span>
242: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_value</span>(<span class="ruby-identifier">s</span>)
243: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"'s' cannot be null"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
244: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">value</span>
245: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000008'>
+ <a name='M000008'></a>
+ <div class='synopsis'>
+ <span class='name'>to_value_array</span>
+ <span class='arguments'>(s)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Parse the string of values and return a list. The string is handled as if
+ it is the values portion of an SDL tag.
+ </p>
+ <p>
+ Example
+ </p>
+ <pre>array = SDL4R.to_value_array("1 true 12:24:01")</pre>
+ <p>
+ Will return an int, a boolean, and a time span.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 256</span>
256: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_value_array</span>(<span class="ruby-identifier">s</span>)
257: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"'s' cannot be null"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
258: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">values</span>
259: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000005'>
+ <a name='M000005'></a>
+ <div class='synopsis'>
+ <span class='name'>validate_identifier</span>
+ <span class='arguments'>(identifier)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Validates an SDL identifier String. SDL Identifiers must start with a
+ Unicode letter or underscore (_) and contain only unicode letters, digits,
+ underscores (_), dashes(-) and periods (.).
+ </p>
+ <h2>Raises</h2>
+ <p>
+ ArgumentError if the identifier is not legal
+ </p>
+ <p>
+ TODO: support UTF-8 identifiers
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 184</span>
184: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validate_identifier</span>(<span class="ruby-identifier">identifier</span>)
185: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">empty?</span>
186: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"SDL identifiers cannot be null or empty."</span>
187: <span class="ruby-keyword kw">end</span>
188: 
189: <span class="ruby-comment cmt"># in Java, was if(!Character.isJavaIdentifierStart(identifier.charAt(0)))</span>
190: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">identifier</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-zA-Z_]/</span>
191: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>,
192: <span class="ruby-value str">"'"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">identifier</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">+</span>
193: <span class="ruby-value str">"' is not a legal first character for an SDL identifier. "</span> <span class="ruby-operator">+</span>
194: <span class="ruby-value str">"SDL Identifiers must start with a unicode letter or "</span> <span class="ruby-operator">+</span>
195: <span class="ruby-value str">"an underscore (_)."</span>
196: <span class="ruby-keyword kw">end</span>
197: 
198: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">identifier</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-zA-Z_][a-zA-Z_0-9\-\.]*$/</span>
199: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">length</span>
200: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">identifier</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">..</span><span class="ruby-identifier">i</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-zA-Z_0-9\-]$/</span>
201: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>,
202: <span class="ruby-value str">"'"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">identifier</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">..</span><span class="ruby-identifier">i</span>] <span class="ruby-operator">+</span> 
203: <span class="ruby-value str">"' is not a legal character for an SDL identifier. "</span> <span class="ruby-operator">+</span>
204: <span class="ruby-value str">"SDL Identifiers must start with a unicode letter or "</span> <span class="ruby-operator">+</span>
205: <span class="ruby-value str">"underscore (_) followed by 0 or more unicode "</span> <span class="ruby-operator">+</span>
206: <span class="ruby-value str">"letters, digits, underscores (_), or dashes (-)"</span>
207: <span class="ruby-keyword kw">end</span>
208: <span class="ruby-keyword kw">end</span>
209: <span class="ruby-keyword kw">end</span>
210: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ </div>
</div>
</div>
</div>
-
- <div id="method-M000003" class="method-detail">
- <a name="M000003"></a>
-
- <div class="method-heading">
- <a href="#M000003" class="method-signature">
- <span class="method-name">new_date_time</span><span class="method-args">(year, month, day, hour, min, sec, time_zone_offset)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Creates and returns the object representing a datetime (DateTime in the
-default implementation). This method is, by default, called by the <a
-href="SDL4R/Parser.html">Parser</a> class. It could be overriden as follows
-in order to get Time instances from all the <a href="SDL4R.html">SDL4R</a>
-parsers.
-</p>
-<pre>
- module SDL4R
- def self.new_date_time(year, month, day, hour, min, sec, time_zone_offset)
- Time.utc(year, month, day, hour, min, sec)
- end
- end
-</pre>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000003-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 139</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
- <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000006" class="method-detail">
- <a name="M000006"></a>
-
- <div class="method-heading">
- <a href="#M000006" class="method-signature">
- <span class="method-name">read</span><span class="method-args">(input)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Creates and returns a tag named "root" and add all the tags
-specified in the given <tt>input</tt>.
-</p>
-<table>
-<tr><td valign="top"><tt>input</tt>:</td><td>String, IO, Pathname or URI.
-
-</td></tr>
-</table>
-<pre>
- root = SDL4R::read(<<EOF
- planets {
- earth area_km2=510900000
- mars
- }
- EOF
- )
-
- root = SDL4R::read(Pathname.new("my_dir/my_file.sdl"))
-
- IO.open("my_dir/my_file.sdl", "r") { |io|
- root = SDL4R::read(io)
- }
-
- root = SDL4R::read(URI.new("http://my_site/my_file.sdl"))
-</pre>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000006-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 232</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">input</span>)
- <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"root"</span>).<span class="ruby-identifier">read</span>(<span class="ruby-identifier">input</span>)
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000009" class="method-detail">
- <a name="M000009"></a>
-
- <div class="method-heading">
- <a href="#M000009" class="method-signature">
- <span class="method-name">to_attribute_map</span><span class="method-args">(s)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Parse a string representing the attributes portion of an SDL tag and return
-the results as a map.
-</p>
-<p>
-Example
-</p>
-<pre>
- hash = SDL4R.to_attribute_hash("value=1 debugging=on time=12:24:01");
-
- # { "value" => 1, "debugging" => true, "time" => SdlTimeSpan.new(12, 24, 01) }
-</pre>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000009-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 270</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_attribute_map</span>(<span class="ruby-identifier">s</span>)
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"'s' cannot be null"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-value str">"atts "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">attributes</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000007" class="method-detail">
- <a name="M000007"></a>
-
- <div class="method-heading">
- <a href="#M000007" class="method-signature">
- <span class="method-name">to_value</span><span class="method-args">(s)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Parses and returns the value corresponding with the specified SDL literal.
-</p>
-<pre>
- SDL4R.to_value("\"abcd\"") # => "abcd"
- SDL4R.to_value("1") # => 1
- SDL4R.to_value("null") # => nil
-</pre>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000007-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 242</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_value</span>(<span class="ruby-identifier">s</span>)
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"'s' cannot be null"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">value</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000008" class="method-detail">
- <a name="M000008"></a>
-
- <div class="method-heading">
- <a href="#M000008" class="method-signature">
- <span class="method-name">to_value_array</span><span class="method-args">(s)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Parse the string of values and return a list. The string is handled as if
-it is the values portion of an SDL tag.
-</p>
-<p>
-Example
-</p>
-<pre>
- array = SDL4R.to_value_array("1 true 12:24:01")
-</pre>
-<p>
-Will return an int, a boolean, and a time span.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000008-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 256</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_value_array</span>(<span class="ruby-identifier">s</span>)
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"'s' cannot be null"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">values</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000005" class="method-detail">
- <a name="M000005"></a>
-
- <div class="method-heading">
- <a href="#M000005" class="method-signature">
- <span class="method-name">validate_identifier</span><span class="method-args">(identifier)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Validates an SDL identifier String. SDL Identifiers must start with a
-Unicode letter or underscore (_) and contain only unicode letters, digits,
-underscores (_), dashes(-) and periods (.).
-</p>
-<h2>Raises</h2>
-<p>
-ArgumentError if the identifier is not legal
-</p>
-<p>
-TODO: support UTF-8 identifiers
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000005-source">
-<pre>
-<span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 184</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validate_identifier</span>(<span class="ruby-identifier">identifier</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">empty?</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"SDL identifiers cannot be null or empty."</span>
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-comment cmt"># in Java, was if(!Character.isJavaIdentifierStart(identifier.charAt(0)))</span>
- <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">identifier</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-zA-Z_]/</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>,
- <span class="ruby-value str">"'"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">identifier</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">+</span>
- <span class="ruby-value str">"' is not a legal first character for an SDL identifier. "</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">"SDL Identifiers must start with a unicode letter or "</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">"an underscore (_)."</span>
- <span class="ruby-keyword kw">end</span>
-
- <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">identifier</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-zA-Z_][a-zA-Z_0-9\-\.]*$/</span>
- <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">length</span>
- <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">identifier</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">..</span><span class="ruby-identifier">i</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-zA-Z_0-9\-]$/</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>,
- <span class="ruby-value str">"'"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">identifier</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">..</span><span class="ruby-identifier">i</span>] <span class="ruby-operator">+</span>
- <span class="ruby-value str">"' is not a legal character for an SDL identifier. "</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">"SDL Identifiers must start with a unicode letter or "</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">"underscore (_) followed by 0 or more unicode "</span> <span class="ruby-operator">+</span>
- <span class="ruby-value str">"letters, digits, underscores (_), or dashes (-)"</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
+ <div id='footer-push'></div>
</div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
\ No newline at end of file
+ <div id='footer'>
+ <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
+ </div>
+ </body>
+</html>