doc/classes/SDL4R.html in sdl4r-0.9.4 vs doc/classes/SDL4R.html in sdl4r-0.9.5
- old
+ new
@@ -1,14 +1,11 @@
-<?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">
-
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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=iso-8859-1" />
+ <title>Module: SDL4R [RDoc: Simple Declarative Language for Ruby]</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[
@@ -23,122 +20,190 @@
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>" )
-
+ 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>
+ <hr size="1"></hr><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>
+
+ <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>
+
</div>
</div>
</div>
-
<!-- if includes -->
<div id="section">
<div id="class-list">
@@ -155,78 +220,100 @@
<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 69</span>
+<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>)
@@ -234,23 +321,30 @@
<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>
+
</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,
@@ -259,15 +353,16 @@
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 149</span>
+<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>
@@ -289,46 +384,54 @@
<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>
+
</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>
+<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)
+<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)
+<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 42</span>
+<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>
@@ -386,11 +489,11 @@
<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">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DateTime</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">get_date_milliseconds</span>(<span class="ruby-identifier">o</span>) <span class="ruby-operator">:</span> (<span class="ruby-identifier">o</span>.<span class="ruby-identifier">usec</span> <span class="ruby-operator">/</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</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>
@@ -411,23 +514,30 @@
<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>
+
</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>
@@ -438,35 +548,43 @@
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 137</span>
+<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
+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.
@@ -487,33 +605,41 @@
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 230</span>
+<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>
@@ -522,66 +648,82 @@
<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 268</span>
+<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 240</span>
+<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>
@@ -591,34 +733,42 @@
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 254</span>
+<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>
@@ -627,15 +777,16 @@
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 182</span>
+<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>
@@ -661,21 +812,24 @@
<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>
- </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
+</html>