ShogunPanda/brauser

View on GitHub
docs/Brauser/Definitions.html

Summary

Maintainability
Test Coverage
<!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: Brauser::Definitions
  
    &mdash; 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#!Brauser/Definitions.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 (D)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Brauser.html" title="Brauser (module)">Brauser</a></span></span>
     &raquo; 
    <span class="title">Definitions</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: Brauser::Definitions
  
  
  
</h1>

<dl class="box">
  
  
    
  
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/brauser/definitions/base.rb<span class="defines">,<br />
  lib/brauser/definitions/browser.rb,<br /> lib/brauser/definitions/platform.rb,<br /> lib/brauser/definitions/language.rb</span>
</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>Definitions used by brauser.</p>


  </div>
</div>
<div class="tags">
  

</div><h2>Defined Under Namespace</h2>
<p class="children">
  
    
  
    
      <strong class="classes">Classes:</strong> <span class='object_link'><a href="Definitions/Base.html" title="Brauser::Definitions::Base (class)">Base</a></span>, <span class='object_link'><a href="Definitions/Browser.html" title="Brauser::Definitions::Browser (class)">Browser</a></span>, <span class='object_link'><a href="Definitions/Language.html" title="Brauser::Definitions::Language (class)">Language</a></span>, <span class='object_link'><a href="Definitions/Platform.html" title="Brauser::Definitions::Platform (class)">Platform</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="#browsers-class_method" title="browsers (class method)">+ (Hash) <strong>browsers</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the list of browser that can be recognized.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#languages-class_method" title="languages (class method)">+ (Hash) <strong>languages</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the list of languages that can be recognized.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#platforms-class_method" title="platforms (class method)">+ (Hash) <strong>platforms</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the list of platforms that can be recognized.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#register-class_method" title="register (class method)">+ (Object) <strong>register</strong>(type, *args, **kwargs, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Registers a new definition.</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="browsers-class_method">
  
    + (<tt>Hash</tt>) <strong>browsers</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the list of browser that can be recognized.</p>

<p>The keys are the ids, the values are the definitions.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The list of browser that can be recognized.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 34</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_browsers'>browsers</span>
  <span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='symbol'>:browsers</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="languages-class_method">
  
    + (<tt>Hash</tt>) <strong>languages</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the list of languages that can be recognized.</p>

<p>The keys are the ids, the values are the definitions.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The list of languages that can be recognized.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


52
53
54</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 52</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_languages'>languages</span>
  <span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='symbol'>:languages</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="platforms-class_method">
  
    + (<tt>Hash</tt>) <strong>platforms</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the list of platforms that can be recognized.</p>

<p>The keys are the ids, the values are the definitions.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The list of platform that can be recognized.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43
44
45</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 43</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_platforms'>platforms</span>
  <span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='symbol'>:platforms</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="register-class_method">
  
    + (<tt>Object</tt>) <strong>register</strong>(type, *args, **kwargs, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Registers a new definition.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>type</span>
      
      
        <span class='type'>(<tt>Symbol</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The type of the definition. Can be <code>:browser</code>, <code>:language</code>, <code>:platform</code>.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>args</span>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The arguments of the definition.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>kwargs</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The keyword arguments of the definition.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>block</span>
      
      
        <span class='type'>(<tt>Proc</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The block of the definition.</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


15
16
17
18
19
20
21
22
23
24
25
26
27</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 15</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_register'>register</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span>
    <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
    <span class='kw'>when</span> <span class='symbol'>:browser</span> <span class='kw'>then</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='op'>::</span><span class='const'>Browser</span>
    <span class='kw'>when</span> <span class='symbol'>:language</span> <span class='kw'>then</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='op'>::</span><span class='const'>Language</span>
    <span class='kw'>when</span> <span class='symbol'>:platform</span> <span class='kw'>then</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='op'>::</span><span class='const'>Platform</span>
    <span class='kw'>else</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid definition type \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot;.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>end</span>

  <span class='ivar'>@definitions</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='label'>browsers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>languages:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>platforms:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rbrace'>}</span>
  <span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>s</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_definition'>definition</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_definition'>definition</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Thu Aug 18 15:49:54 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.6 (ruby-2.3.0).
</div>

  </body>
</html>