doc/Ionian/Server.html in ionian-0.6.3 vs doc/Ionian/Server.html in ionian-0.6.4
- old
+ new
@@ -1,438 +1,670 @@
-<!DOCTYPE html>
+<!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>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Class: Ionian::Server
+
+ — Documentation by YARD 0.8.7.3
+
+</title>
-<html>
-<head>
-<meta charset="UTF-8">
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
-<title>class Ionian::Server - RDoc Documentation</title>
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
-<link href="../fonts.css" rel="stylesheet">
-<link href="../rdoc.css" rel="stylesheet">
-
-<script type="text/javascript">
- var rdoc_rel_prefix = "../";
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '../';
+ framesUrl = "../frames.html#!" + escape(window.location.href);
</script>
-<script src="../js/jquery.js"></script>
-<script src="../js/navigation.js"></script>
-<script src="../js/search_index.js"></script>
-<script src="../js/search.js"></script>
-<script src="../js/searcher.js"></script>
-<script src="../js/darkfish.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
-<body id="top" role="document" class="class">
-<nav role="navigation">
- <div id="project-navigation">
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
- <h2>
- <a href="../index.html" rel="home">Home</a>
- </h2>
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
- <div id="table-of-contents-navigation">
- <a href="../table_of_contents.html#pages">Pages</a>
- <a href="../table_of_contents.html#classes">Classes</a>
- <a href="../table_of_contents.html#methods">Methods</a>
- </div>
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (S)</a> »
+ <span class='title'><span class='object_link'><a href="../Ionian.html" title="Ionian (module)">Ionian</a></span></span>
+ »
+ <span class="title">Server</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
- <div id="search-section" role="search" class="project-section initially-hidden">
- <form action="#" method="get" accept-charset="utf-8">
- <div id="search-field-wrapper">
- <input id="search-field" role="combobox" aria-label="Search"
- aria-autocomplete="list" aria-controls="search-results"
- type="text" name="search" placeholder="Search" spellcheck="false"
- title="Type to search, Up and Down to navigate, Enter to load">
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="../method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="../file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
</div>
- <ul id="search-results" aria-label="Search Results"
- aria-busy="false" aria-expanded="false"
- aria-atomic="false" class="initially-hidden"></ul>
- </form>
-</div>
+ <iframe id="search_frame"></iframe>
- </div>
+ <div id="content"><h1>Class: Ionian::Server
+
+
+
+</h1>
+<dl class="box">
+ <dt class="r1">Inherits:</dt>
+ <dd class="r1">
+ <span class="inheritName">Object</span>
+
+ <ul class="fullTree">
+ <li>Object</li>
+
+ <li class="next">Ionian::Server</li>
+
+ </ul>
+ <a href="#" class="inheritanceTree">show all</a>
+
+ </dd>
+
+
+
+
+
+
+
+
+
+ <dt class="r2 last">Defined in:</dt>
+ <dd class="r2 last">lib/ionian/server.rb</dd>
+
+</dl>
+<div class="clear"></div>
- <div id="class-metadata">
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
- <div id="parent-class-section" class="nav-section">
- <h3>Parent</h3>
+<p>A convenient wrapper for TCP, UDP, and Unix server sockets.</p>
+
+ </div>
+</div>
+<div class="tags">
- <p class="link">Object
-
+
</div>
+
+
+
+
+
+
+ <h2>
+ Instance Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+ <a href="#close-instance_method" title="#close (instance method)">- (Object) <strong>close</strong> </a>
- <!-- Method Quickref -->
-<div id="method-list-section" class="nav-section">
- <h3>Methods</h3>
- <ul class="link-list" role="directory">
- <li ><a href="#method-c-new">::new</a>
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Shutdown the server socket and stop listening for connections.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
- <li ><a href="#method-i-close">#close</a>
+ <a href="#closed%3F-instance_method" title="#closed? (instance method)">- (Boolean) <strong>closed?</strong> </a>
- <li ><a href="#method-i-closed-3F">#closed?</a>
+
- <li ><a href="#method-i-listen">#listen</a>
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Returns true if the server listener socket is closed.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
- <li ><a href="#method-i-on_accept">#on_accept</a>
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Server) <strong>initialize</strong>(**kwargs, &block) </a>
- <li ><a href="#method-i-register_accept_listener">#register_accept_listener</a>
+
- <li ><a href="#method-i-unregister_accept_listener">#unregister_accept_listener</a>
-
- </ul>
-</div>
+ </span>
+
+
+ <span class="note title constructor">constructor</span>
+
+
+
+
+
+
- </div>
-</nav>
+
+ <span class="summary_desc"><div class='inline'>
+<p>A convenient wrapper for TCP and Unix server sockets (UDP doesn't use a
+server).</p>
+</div></span>
+
+</li>
-<main role="main" aria-labelledby="class-Ionian::Server">
- <h1 id="class-Ionian::Server" class="class">
- class Ionian::Server
- </h1>
-
- <section class="description">
+
+ <li class="public ">
+ <span class="summary_signature">
-<p>A convenient wrapper for TCP, UDP, and Unix server sockets.</p>
+ <a href="#listen-instance_method" title="#listen (instance method)">- (Object) <strong>listen</strong>(&block) </a>
+
- </section>
-
+
+ </span>
- <section id="5Buntitled-5D" class="documentation-section">
-
+
+
+
+
-
+
+ <span class="summary_desc"><div class='inline'>
+<p>Starts the socket server listening for connections.</p>
+</div></span>
+
+</li>
+
+ <li class="public ">
+ <span class="summary_signature">
+ <a href="#register_accept_listener-instance_method" title="#register_accept_listener (instance method)">- (Object) <strong>register_accept_listener</strong>(&block) </a>
+
+ (also: #on_accept)
+
+ </span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Register a block to be run when server accepts a client connection.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
- <header>
- <h3>Public Class Methods</h3>
- </header>
+ <a href="#unregister_accept_listener-instance_method" title="#unregister_accept_listener (instance method)">- (Object) <strong>unregister_accept_listener</strong>(proc) </a>
+
- <div id="method-c-new" class="method-detail ">
-
- <div class="method-heading">
- <span class="method-name">new</span><span
- class="method-args">(**kwargs, &block)</span>
-
- <span class="method-click-advice">click to toggle source</span>
-
- </div>
-
+ </span>
+
+
+
+
+
+
+
- <div class="method-description">
-
- <p>A convenient wrapper for TCP and Unix server sockets (UDP doesn't use a
+
+ <span class="summary_desc"><div class='inline'>
+<p>Unregisters a socket accept notifier block.</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+<div id="constructor_details" class="method_details_list">
+ <h2>Constructor Details</h2>
+
+ <div class="method_details first">
+ <h3 class="signature first" id="initialize-instance_method">
+
+ - (<tt><span class='object_link'><a href="" title="Ionian::Server (class)">Server</a></span></tt>) <strong>initialize</strong>(**kwargs, &block)
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>A convenient wrapper for TCP and Unix server sockets (UDP doesn't use a
server).</p>
-<p>Accepts an optional block that is passed to <a
-href="Server.html#method-i-register_accept_listener">register_accept_listener</a>.
-<a href="Server.html">Server</a> opens listening socket on instantiation if
-this block is provided.</p>
+<p>Accepts an optional block that is passed to #register_accept_listener.
+Server opens listening socket on instantiation if this block is provided.</p>
<p>Args:</p>
-<pre>interface: The address of the network interface to bind to.
+<pre class="code ruby"><code class="ruby">interface: The address of the network interface to bind to.
Defaults to all.
-protocol: :tcp, :unix. Default is :tcp.</pre>
-
-
+protocol: :tcp, :unix. Default is :tcp.</code></pre>
-
- <div class="method-source-code" id="new-source">
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 19</span>
-<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
- <span class="ruby-ivar">@accept_listeners</span> = []
- <span class="ruby-identifier">register_accept_listener</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
+
+ </div>
+</div>
+<div class="tags">
- <span class="ruby-ivar">@interface</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:interface</span>, <span class="ruby-string">''</span>
- <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:port</span>, <span class="ruby-keyword">nil</span>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 19</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
+ <span class='ivar'>@accept_listeners</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
+ <span class='id identifier rubyid_register_accept_listener'>register_accept_listener</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
+ <span class='ivar'>@interface</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:interface</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
+ <span class='ivar'>@port</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:port</span><span class='comma'>,</span> <span class='kw'>nil</span>
- <span class="ruby-comment"># Automatically select UDP for the multicast range. Otherwise default to TCP.</span>
- <span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:tcp</span>
- <span class="ruby-comment"># TODO: This ivar may be incorrect for UDP -- bound interface is not destination.</span>
- <span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:udp</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Ionian</span><span class="ruby-operator">::</span><span class="ruby-constant">Extension</span><span class="ruby-operator">::</span><span class="ruby-constant">Socket</span>.<span class="ruby-identifier">multicast?</span> <span class="ruby-ivar">@interface</span>
- <span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:unix</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@interface</span>.<span class="ruby-identifier">start_with?</span> <span class="ruby-string">'/'</span>
- <span class="ruby-ivar">@protocol</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:protocol</span>, <span class="ruby-identifier">default_protocol</span>
+ <span class='comment'># Automatically select UDP for the multicast range. Otherwise default to TCP.
+</span> <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:tcp</span>
+ <span class='comment'># TODO: This ivar may be incorrect for UDP -- bound interface is not destination.
+</span> <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:udp</span> <span class='kw'>if</span> <span class='const'>Ionian</span><span class='op'>::</span><span class='const'>Extension</span><span class='op'>::</span><span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_multicast?'>multicast?</span> <span class='ivar'>@interface</span>
+ <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:unix</span> <span class='kw'>if</span> <span class='ivar'>@interface</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span>
- <span class="ruby-comment"># TODO: Move this to #listen.</span>
- <span class="ruby-keyword">case</span> <span class="ruby-ivar">@protocol</span>
- <span class="ruby-keyword">when</span> <span class="ruby-value">:tcp</span>
- <span class="ruby-ivar">@server</span> = <span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@interface</span>, <span class="ruby-ivar">@port</span>
- <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">setsockopt</span> <span class="ruby-operator">::</span><span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">SOL_SOCKET</span>, <span class="ruby-operator">::</span><span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">SO_REUSEADDR</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">'i'</span>)
- <span class="ruby-keyword">when</span> <span class="ruby-value">:udp</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"UDP should be implemented with Ionian::Socket."</span>
- <span class="ruby-keyword">when</span> <span class="ruby-value">:unix</span>
- <span class="ruby-ivar">@server</span> = <span class="ruby-constant">UNIXServer</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@interface</span>
- <span class="ruby-keyword">end</span>
+ <span class='ivar'>@protocol</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:protocol</span><span class='comma'>,</span> <span class='id identifier rubyid_default_protocol'>default_protocol</span>
- <span class="ruby-identifier">listen</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
-
- </div>
+ <span class='comment'># TODO: Move this to #listen.
+</span> <span class='kw'>case</span> <span class='ivar'>@protocol</span>
+ <span class='kw'>when</span> <span class='symbol'>:tcp</span>
+ <span class='ivar'>@server</span> <span class='op'>=</span> <span class='const'>TCPServer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='ivar'>@interface</span><span class='comma'>,</span> <span class='ivar'>@port</span>
+ <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_setsockopt'>setsockopt</span> <span class='op'>::</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>SOL_SOCKET</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>SO_REUSEADDR</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_pack'>pack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>i</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
+ <span class='kw'>when</span> <span class='symbol'>:udp</span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>UDP should be implemented with Ionian::Socket.</span><span class='tstring_end'>"</span></span>
+ <span class='kw'>when</span> <span class='symbol'>:unix</span>
+ <span class='ivar'>@server</span> <span class='op'>=</span> <span class='const'>UNIXServer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='ivar'>@interface</span>
+ <span class='kw'>end</span>
+
+ <span class='id identifier rubyid_listen'>listen</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+</div>
-
-
- </div>
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
- </section>
+ <div class="method_details first">
+ <h3 class="signature first" id="close-instance_method">
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
- <header>
- <h3>Public Instance Methods</h3>
- </header>
+ - (<tt>Object</tt>) <strong>close</strong>
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
- <div id="method-i-close" class="method-detail ">
-
- <div class="method-heading">
- <span class="method-name">close</span><span
- class="method-args">()</span>
-
- <span class="method-click-advice">click to toggle source</span>
-
- </div>
-
+<p>Shutdown the server socket and stop listening for connections.</p>
- <div class="method-description">
-
- <p>Shutdown the server socket and stop listening for connections.</p>
-
-
-
- <div class="method-source-code" id="close-source">
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 74</span>
-<span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>
- <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@server</span>
- <span class="ruby-ivar">@accept_thread</span>.<span class="ruby-identifier">join</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@accept_thread</span>
- <span class="ruby-ivar">@accept_thread</span> = <span class="ruby-keyword">nil</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
-
- </div>
+ </div>
+</div>
+<div class="tags">
+
-
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
-
- </div>
+74
+75
+76
+77
+78</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 74</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
+ <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span> <span class='kw'>if</span> <span class='ivar'>@server</span>
+ <span class='ivar'>@accept_thread</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='kw'>if</span> <span class='ivar'>@accept_thread</span>
+ <span class='ivar'>@accept_thread</span> <span class='op'>=</span> <span class='kw'>nil</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
- <div id="method-i-closed-3F" class="method-detail ">
-
- <div class="method-heading">
- <span class="method-name">closed?</span><span
- class="method-args">()</span>
-
- <span class="method-click-advice">click to toggle source</span>
-
- </div>
-
+ <div class="method_details ">
+ <h3 class="signature " id="closed?-instance_method">
+
+ - (<tt>Boolean</tt>) <strong>closed?</strong>
+
- <div class="method-description">
-
- <p>Returns true if the server listener socket is closed.</p>
-
-
+
-
- <div class="method-source-code" id="closed-3F-source">
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 81</span>
-<span class="ruby-keyword">def</span> <span class="ruby-identifier">closed?</span>
- <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">closed?</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
-
- </div>
-
-
-
-
- </div>
-
+
+</h3><div class="docstring">
+ <div class="discussion">
- <div id="method-i-listen" class="method-detail ">
-
- <div class="method-heading">
- <span class="method-name">listen</span><span
- class="method-args">(&block)</span>
-
- <span class="method-click-advice">click to toggle source</span>
-
- </div>
-
+<p>Returns true if the server listener socket is closed.</p>
- <div class="method-description">
-
- <p>Starts the socket server listening for connections. Blocks registered with
-<a
-href="Server.html#method-i-register_accept_listener">register_accept_listener</a>
-will be run when a connection is accepted.</p>
-
-
-
- <div class="method-source-code" id="listen-source">
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 52</span>
-<span class="ruby-keyword">def</span> <span class="ruby-identifier">listen</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
- <span class="ruby-identifier">register_accept_listener</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
+ </div>
+</div>
+<div class="tags">
- <span class="ruby-ivar">@accept_thread</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span>
- <span class="ruby-comment"># Package in an Ionian::Socket</span>
- <span class="ruby-keyword">begin</span>
- <span class="ruby-identifier">client</span> = <span class="ruby-constant">Ionian</span><span class="ruby-operator">::</span><span class="ruby-constant">Socket</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">accept</span>
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
- <span class="ruby-ivar">@accept_listeners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">listener</span><span class="ruby-operator">|</span>
- <span class="ruby-identifier">listener</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">client</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EBADF</span>
- <span class="ruby-comment"># This ignores the connection if the client closed it before it</span>
- <span class="ruby-comment"># could be accepted.</span>
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">IOError</span>
- <span class="ruby-comment"># This ignores the connection if the client closed it before it</span>
- <span class="ruby-comment"># could be accepted.</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-keyword">end</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
-
- </div>
+
+ <span class='type'>(<tt>Boolean</tt>)</span>
+
+
+
+ </li>
+
+</ul>
-
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
-
- </div>
+81
+82
+83</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 81</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span>
+ <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
- <div id="method-i-on_accept" class="method-detail method-alias">
-
- <div class="method-heading">
- <span class="method-name">on_accept</span><span
- class="method-args">(&block)</span>
-
- </div>
-
+ <div class="method_details ">
+ <h3 class="signature " id="listen-instance_method">
+
+ - (<tt>Object</tt>) <strong>listen</strong>(&block)
+
- <div class="method-description">
-
-
-
-
+
-
- </div>
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Starts the socket server listening for connections. Blocks registered with
+#register_accept_listener will be run when a connection is accepted.</p>
-
-
- <div class="aliases">
- Alias for: <a href="Server.html#method-i-register_accept_listener">register_accept_listener</a>
- </div>
-
- </div>
+ </div>
+</div>
+<div class="tags">
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 52</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_listen'>listen</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
+ <span class='id identifier rubyid_register_accept_listener'>register_accept_listener</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
+
+ <span class='ivar'>@accept_thread</span> <span class='op'>||=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
+ <span class='comment'># Package in an Ionian::Socket
+</span> <span class='kw'>begin</span>
+ <span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'>Ionian</span><span class='op'>::</span><span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_accept'>accept</span>
+
+ <span class='ivar'>@accept_listeners</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_listener'>listener</span><span class='op'>|</span>
+ <span class='id identifier rubyid_listener'>listener</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='id identifier rubyid_client'>client</span>
+ <span class='kw'>end</span>
+ <span class='kw'>rescue</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>EBADF</span>
+ <span class='comment'># This ignores the connection if the client closed it before it
+</span> <span class='comment'># could be accepted.
+</span> <span class='kw'>rescue</span> <span class='const'>IOError</span>
+ <span class='comment'># This ignores the connection if the client closed it before it
+</span> <span class='comment'># could be accepted.
+</span> <span class='kw'>end</span>
+ <span class='kw'>end</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
- <div id="method-i-register_accept_listener" class="method-detail ">
-
- <div class="method-heading">
- <span class="method-name">register_accept_listener</span><span
- class="method-args">(&block)</span>
-
- <span class="method-click-advice">click to toggle source</span>
-
- </div>
-
+ <div class="method_details ">
+ <h3 class="signature " id="register_accept_listener-instance_method">
+
+ - (<tt>Object</tt>) <strong>register_accept_listener</strong>(&block)
+
- <div class="method-description">
-
- <p>Register a block to be run when server accepts a client connection. The
+
+ <span class="aliases">Also known as:
+ <span class="names"><span id='on_accept-instance_method'>on_accept</span></span>
+ </span>
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Register a block to be run when server accepts a client connection. The
connected client is passed to the block as an Ionain::Client.</p>
-
-
-
- <div class="method-source-code" id="register_accept_listener-source">
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 87</span>
-<span class="ruby-keyword">def</span> <span class="ruby-identifier">register_accept_listener</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
- <span class="ruby-ivar">@accept_listeners</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@accept_listeners</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">block</span>
- <span class="ruby-identifier">block</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
-
- </div>
-
- <div class="aliases">
- Also aliased as: <a href="Server.html#method-i-on_accept">on_accept</a>
- </div>
-
+ </div>
+</div>
+<div class="tags">
+
-
- </div>
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+87
+88
+89
+90</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 87</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_register_accept_listener'>register_accept_listener</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
+ <span class='ivar'>@accept_listeners</span> <span class='op'><<</span> <span class='id identifier rubyid_block'>block</span> <span class='kw'>unless</span> <span class='ivar'>@accept_listeners</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_block'>block</span>
+ <span class='id identifier rubyid_block'>block</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
- <div id="method-i-unregister_accept_listener" class="method-detail ">
-
- <div class="method-heading">
- <span class="method-name">unregister_accept_listener</span><span
- class="method-args">(proc)</span>
-
- <span class="method-click-advice">click to toggle source</span>
-
- </div>
-
+ <div class="method_details ">
+ <h3 class="signature " id="unregister_accept_listener-instance_method">
+
+ - (<tt>Object</tt>) <strong>unregister_accept_listener</strong>(proc)
+
- <div class="method-description">
-
- <p>Unregisters a socket accept notifier block.</p>
-
-
+
-
- <div class="method-source-code" id="unregister_accept_listener-source">
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 95</span>
-<span class="ruby-keyword">def</span> <span class="ruby-identifier">unregister_accept_listener</span> <span class="ruby-identifier">proc</span>
- <span class="ruby-ivar">@accept_listeners</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">o</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">proc</span>}
- <span class="ruby-identifier">proc</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
-
- </div>
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Unregisters a socket accept notifier block.</p>
-
-
- </div>
+ </div>
+</div>
+<div class="tags">
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+95
+96
+97
+98</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 95</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_unregister_accept_listener'>unregister_accept_listener</span> <span class='id identifier rubyid_proc'>proc</span>
+ <span class='ivar'>@accept_listeners</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_o'>o</span><span class='op'>|</span> <span class='id identifier rubyid_o'>o</span> <span class='op'>==</span> <span class='id identifier rubyid_proc'>proc</span><span class='rbrace'>}</span>
+ <span class='id identifier rubyid_proc'>proc</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
- </section>
-
- </section>
-</main>
+ </div>
+</div>
-<footer id="validator-badges" role="contentinfo">
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
- <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
-</footer>
+ <div id="footer">
+ Generated on Sat Mar 15 21:04:54 2014 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.7.3 (ruby-2.1.1).
+</div>
+ </body>
+</html>
\ No newline at end of file