<!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> Module: Ballast — Documentation by YARD 0.8.7.6 </title> <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = ''; framesUrl = "frames.html#!Ballast.html"; </script> <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="js/app.js"></script> </head> <body> <div id="header"> <div id="menu"> <a href="_index.html">Index (B)</a> » <span class="title">Ballast</span> <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <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> <iframe id="search_frame"></iframe> <div id="content"><h1>Module: Ballast </h1> <dl class="box"> <dt class="r1 last">Defined in:</dt> <dd class="r1 last">lib/ballast.rb<span class="defines">,<br /> lib/ballast/emoji.rb,<br /> lib/ballast/errors.rb,<br /> lib/ballast/version.rb,<br /> lib/ballast/service.rb,<br /> lib/ballast/configuration.rb,<br /> lib/ballast/concerns/view.rb,<br /> lib/ballast/ajax_response.rb,<br /> lib/ballast/concerns/common.rb,<br /> lib/ballast/request_domain_matcher.rb,<br /> lib/ballast/concerns/ajax_handling.rb,<br /> lib/ballast/concerns/errors_handling.rb,<br /> lib/ballast/middlewares/default_host.rb</span> </dd> </dl> <div class="clear"></div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> <p>This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <a href="mailto:shogun@cowtech.it">shogun@cowtech.it</a>. Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p> </div> </div> <div class="tags"> </div><h2>Defined Under Namespace</h2> <p class="children"> <strong class="modules">Modules:</strong> <span class='object_link'><a href="Ballast/Concerns.html" title="Ballast::Concerns (module)">Concerns</a></span>, <span class='object_link'><a href="Ballast/Emoji.html" title="Ballast::Emoji (module)">Emoji</a></span>, <span class='object_link'><a href="Ballast/Errors.html" title="Ballast::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Ballast/Middlewares.html" title="Ballast::Middlewares (module)">Middlewares</a></span>, <span class='object_link'><a href="Ballast/Version.html" title="Ballast::Version (module)">Version</a></span> <strong class="classes">Classes:</strong> <span class='object_link'><a href="Ballast/AjaxResponse.html" title="Ballast::AjaxResponse (class)">AjaxResponse</a></span>, <span class='object_link'><a href="Ballast/Configuration.html" title="Ballast::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Ballast/RequestDomainMatcher.html" title="Ballast::RequestDomainMatcher (class)">RequestDomainMatcher</a></span>, <span class='object_link'><a href="Ballast/Service.html" title="Ballast::Service (class)">Service</a></span> </p> <h2> Class Method Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#in_em_thread-class_method" title="in_em_thread (class method)">+ (Object) <strong>in_em_thread</strong>(start_reactor = false, &block) </a> </span> <span class="summary_desc"><div class='inline'><p>If running under eventmachine, runs the block in a thread of its threadpool using EM::Synchrony, otherwise runs the block directly.</p> </div></span> </li> </ul> <div id="class_method_details" class="method_details_list"> <h2>Class Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="in_em_thread-class_method"> + (<tt>Object</tt>) <strong>in_em_thread</strong>(start_reactor = false, &block) </h3><div class="docstring"> <div class="discussion"> <p>If running under eventmachine, runs the block in a thread of its threadpool using EM::Synchrony, otherwise runs the block directly.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>start_reactor</span> <span class='type'>(<tt>Boolean</tt>)</span> <em class="default">(defaults to: <tt>false</tt>)</em> — <div class='inline'><p>If start a EM::Synchrony reactor if none is running.</p> </div> </li> <li> <span class='name'>block</span> <span class='type'>(<tt>Proc</tt>)</span> — <div class='inline'><p>The block to run.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 38 39 40 41 42 43 44 45 46 47 48 49</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast.rb', line 38</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_in_em_thread'>in_em_thread</span><span class='lparen'>(</span><span class='id identifier rubyid_start_reactor'>start_reactor</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_reactor_running?'>reactor_running?</span> <span class='id identifier rubyid_run_in_thread'>run_in_thread</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>elsif</span> <span class='id identifier rubyid_start_reactor'>start_reactor</span> <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_synchrony'>synchrony</span> <span class='kw'>do</span> <span class='const'>Ballast</span><span class='period'>.</span><span class='id identifier rubyid_in_em_thread'>in_em_thread</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='kw'>end</span> <span class='kw'>else</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Fri Dec 26 11:54:46 2014 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.8.7.6 (ruby-2.1.3). </div> </body> </html>