<!DOCTYPE html> <html>
<head> <meta charset="utf-8">
<meta name=“viewport” content=“width=device-width, initial-scale=1.0”> <title>
Class: Alimento::Lista — Documentation by YARD 0.9.9
</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”>
pathId = "Alimento::Lista"; relpath = '../';
</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 class="nav_wrap"> <iframe id="nav" src="../class_list.html?1"></iframe> <div id="resizer"></div> </div> <div id="main" tabindex="-1"> <div id="header"> <div id="menu"> <a href="../_index.html">Index (L)</a> » <span class='title'><span class='object_link'><a href="../Alimento.html" title="Alimento (module)">Alimento</a></span></span> » <span class="title">Lista</span>
</div>
<div id="search"> <a class="full_list_link" id="class_list_link" href="../class_list.html"> <svg width="24" height="24"> <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect> </svg> </a>
</div>
<div class="clear"></div> </div> <div id="content"><h1>Class: Alimento::Lista
</h1> <div class=“box_info”>
<dl> <dt>Inherits:</dt> <dd> <span class="inheritName">Object</span> <ul class="fullTree"> <li>Object</li> <li class="next">Alimento::Lista</li> </ul> <a href="#" class="inheritanceTree">show all</a> </dd> </dl> <dl> <dt>Includes:</dt> <dd>Enumerable</dd> </dl> <dl> <dt>Defined in:</dt> <dd>lib/alimento/lista.rb</dd> </dl>
</div>
<h2>Overview</h2><div class=“docstring”>
<div class="discussion">
<p>Clase que representa a una lista doblemente enlazada Se ha incluido el mixin Enumerable</p>
</div>
</div> <div class=“tags”>
</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="#each-instance_method" title="#each (instance method)">#<strong>each</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'>
<p>Se incluye el método del mixin Enumerable Se define como una iteración sobre los valores de cada nodod de la lista.</p> </div></span>
</li>
<li class="public "> <span class="summary_signature"> <a href="#head-instance_method" title="#head (instance method)">#<strong>head</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'>
<p>Getter/Setter de @head.</p> </div></span>
</li>
<li class="public "> <span class="summary_signature"> <a href="#head_out-instance_method" title="#head_out (instance method)">#<strong>head_out</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'>
<p>Método que extrae/elimina el primer valor de la lista.</p> </div></span>
</li>
<li class="public "> <span class="summary_signature"> <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(head, tail) ⇒ Lista </a> </span> <span class="note title constructor">constructor</span> <span class="summary_desc"><div class='inline'>
<p>Se asignan la cabeza (@head) y la cola (@tail) y se enlazan.</p> </div></span>
</li>
<li class="public "> <span class="summary_signature"> <a href="#insert-instance_method" title="#insert (instance method)">#<strong>insert</strong>(nodo) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'>
<p>Método que inserta un nodo en la cabeza de la lista.</p> </div></span>
</li>
<li class="public "> <span class="summary_signature"> <a href="#tail-instance_method" title="#tail (instance method)">#<strong>tail</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'>
<p>Getter/Setter de @tail.</p> </div></span>
</li>
<li class="public "> <span class="summary_signature"> <a href="#tail_out-instance_method" title="#tail_out (instance method)">#<strong>tail_out</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'>
<p>Método que extrae/elimina el último valor de la lista.</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"> #<strong>initialize</strong>(head, tail) ⇒ <tt><span class='object_link'><a href="" title="Alimento::Lista (class)">Lista</a></span></tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Se asignan la cabeza (@head) y la cola (@tail) y se enlazan</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
12 13 14 15 16 17 18</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 12</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_head'>head</span><span class='comma'>,</span> <span class='id identifier rubyid_tail'>tail</span><span class='rparen'>)</span>
<span class='ivar'>@head</span> <span class='op'>=</span> <span class='id identifier rubyid_head'>head</span> <span class='ivar'>@tail</span> <span class='op'>=</span> <span class='id identifier rubyid_tail'>tail</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_siguiente'>siguiente</span> <span class='op'>=</span> <span class='ivar'>@tail</span> <span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_anterior'>anterior</span> <span class='op'>=</span> <span class='ivar'>@head</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
</div>
<div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="each-instance_method"> #<strong>each</strong> ⇒ <tt>Object</tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Se incluye el método del mixin Enumerable Se define como una iteración sobre los valores de cada nodod de la lista</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
59 60 61 62 63 64 65</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span>
<span class='id identifier rubyid_tmp'>tmp</span> <span class='op'>=</span> <span class='ivar'>@head</span> <span class='kw'>while</span> <span class='id identifier rubyid_tmp'>tmp</span> <span class='op'>!=</span> <span class='kw'>nil</span> <span class='kw'>do</span> <span class='kw'>yield</span> <span class='id identifier rubyid_tmp'>tmp</span><span class='period'>.</span><span class='id identifier rubyid_valor'>valor</span> <span class='id identifier rubyid_tmp'>tmp</span> <span class='op'>=</span> <span class='id identifier rubyid_tmp'>tmp</span><span class='period'>.</span><span class='id identifier rubyid_siguiente'>siguiente</span> <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
<div class="method_details "> <h3 class="signature " id="head-instance_method"> #<strong>head</strong> ⇒ <tt>Object</tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Getter/Setter de @head</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
21 22 23</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 21</span>
<span class='kw'>def</span> <span class='id identifier rubyid_head'>head</span>
<span class='ivar'>@head</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
<div class="method_details "> <h3 class="signature " id="head_out-instance_method"> #<strong>head_out</strong> ⇒ <tt>Object</tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Método que extrae/elimina el primer valor de la lista</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
42 43 44 45 46 47</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 42</span>
<span class='kw'>def</span> <span class='id identifier rubyid_head_out'>head_out</span>
<span class='id identifier rubyid_aux'>aux</span> <span class='op'>=</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_siguiente'>siguiente</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_siguiente'>siguiente</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='ivar'>@head</span> <span class='op'>=</span> <span class='id identifier rubyid_aux'>aux</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_anterior'>anterior</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
<div class="method_details "> <h3 class="signature " id="insert-instance_method"> #<strong>insert</strong>(nodo) ⇒ <tt>Object</tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Método que inserta un nodo en la cabeza de la lista</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
31 32 33 34 35 36 37 38 39</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 31</span>
<span class='kw'>def</span> <span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_nodo'>nodo</span><span class='rparen'>)</span>
<span class='kw'>if</span><span class='lparen'>(</span><span class='id identifier rubyid_nodo'>nodo</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='const'>Nodo</span><span class='rparen'>)</span> <span class='kw'>then</span> <span class='id identifier rubyid_aux'>aux</span> <span class='op'>=</span> <span class='ivar'>@head</span> <span class='ivar'>@head</span> <span class='op'>=</span> <span class='id identifier rubyid_nodo'>nodo</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_anterior'>anterior</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_siguiente'>siguiente</span> <span class='op'>=</span> <span class='id identifier rubyid_aux'>aux</span> <span class='id identifier rubyid_aux'>aux</span><span class='period'>.</span><span class='id identifier rubyid_anterior'>anterior</span> <span class='op'>=</span> <span class='ivar'>@head</span> <span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
<div class="method_details "> <h3 class="signature " id="tail-instance_method"> #<strong>tail</strong> ⇒ <tt>Object</tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Getter/Setter de @tail</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
26 27 28</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 26</span>
<span class='kw'>def</span> <span class='id identifier rubyid_tail'>tail</span>
<span class='ivar'>@tail</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
<div class="method_details "> <h3 class="signature " id="tail_out-instance_method"> #<strong>tail_out</strong> ⇒ <tt>Object</tt>
</h3><div class=“docstring”>
<div class="discussion">
<p>Método que extrae/elimina el último valor de la lista</p>
</div>
</div> <div class=“tags”>
</div><table class=“source_code”>
<tr> <td> <pre class="lines">
50 51 52 53 54 55</pre>
</td> <td> <pre class="code"><span class="info file"># File 'lib/alimento/lista.rb', line 50</span>
<span class='kw'>def</span> <span class='id identifier rubyid_tail_out'>tail_out</span>
<span class='id identifier rubyid_aux'>aux</span> <span class='op'>=</span> <span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_anterior'>anterior</span> <span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_anterior'>anterior</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='ivar'>@tail</span> <span class='op'>=</span> <span class='id identifier rubyid_aux'>aux</span> <span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_siguiente'>siguiente</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td> </tr>
</table> </div>
</div>
</div>
<div id="footer"> Generated on Fri Nov 17 00:05:17 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.9 (ruby-2.3.0).
</div>
</div> </body>
</html>