diff options
| author | _Tradam <[email protected]> | 2021-12-30 07:34:26 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-30 07:34:26 -0500 |
| commit | b535a6b1bd8019dbeba17f3853b338383208c9b3 (patch) | |
| tree | a1feb0d69557f1a24f9884567d0d939c129c6447 /docs/FelFlame/ComponentManager.html | |
| parent | 5ef652300e71b572ca58b061610d606840ce19a9 (diff) | |
| parent | 3104eaf4ca0515572aeedc114cb6095a07825d90 (diff) | |
| download | FelECS-b535a6b1bd8019dbeba17f3853b338383208c9b3.tar.gz FelECS-b535a6b1bd8019dbeba17f3853b338383208c9b3.zip | |
Merge pull request #13 from realtradam/revert-12-arry
Revert "Major 4.0 update (#12)"
Diffstat (limited to 'docs/FelFlame/ComponentManager.html')
| -rw-r--r-- | docs/FelFlame/ComponentManager.html | 569 |
1 files changed, 432 insertions, 137 deletions
diff --git a/docs/FelFlame/ComponentManager.html b/docs/FelFlame/ComponentManager.html index 599b547..1da6816 100644 --- a/docs/FelFlame/ComponentManager.html +++ b/docs/FelFlame/ComponentManager.html @@ -37,7 +37,7 @@ <div id="menu"> <a href="../_index.html">Index (C)</a> » - <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span> + <span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span> » <span class="title">ComponentManager</span> @@ -102,7 +102,7 @@ <h2>Overview</h2><div class="docstring"> <div class="discussion"> -<p>Component Managers are what is used to create individual components which can be attached to entities. When a Component is created from a Component Manager that has accessors given to it, you can set or get the values of those accessors using standard ruby message sending (e.g <tt>@component.var = 5</tt>), or by using the #attrs and <span class='object_link'><a href="#update_attrs-instance_method" title="FelFlame::ComponentManager#update_attrs (method)">#update_attrs</a></span> methods instead.</p> +<p>Component Managers are what is used to create individual components which can be attached to entities. When a Component is created from a Component Manager that has accessors given to it, you can set or get the values of those accessors using standard ruby message sending (e.g <tt>@component.var = 5</tt>), or by using the <span class='object_link'><a href="#attrs-instance_method" title="FelFlame::ComponentManager#attrs (method)">#attrs</a></span> and <span class='object_link'><a href="#update_attrs-instance_method" title="FelFlame::ComponentManager#update_attrs (method)">#update_attrs</a></span> methods instead.</p> </div> @@ -270,6 +270,35 @@ <li class="public "> <span class="summary_signature"> + <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> ⇒ Integer </a> + + + + </span> + + + + + <span class="note title readonly">readonly</span> + + + + + + + + + + <span class="summary_desc"><div class='inline'> +<p>Holds the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span> of a component.</p> +</div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + <a href="#removal_triggers-instance_method" title="#removal_triggers (instance method)">#<strong>removal_triggers</strong> ⇒ Array<System> </a> @@ -303,6 +332,63 @@ <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="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(component_id) ⇒ Component </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'> +<p>Gets a Component from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span>.</p> +</div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&block) ⇒ Enumerator </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'> +<p>Iterates over all components within the component manager.</p> +</div></span> + +</li> + + + </ul> + + <h2> Instance Method Summary <small><a href="#" class="summary_toggle">collapse</a></small> </h2> @@ -336,7 +422,7 @@ <li class="public "> <span class="summary_signature"> - <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong> ⇒ Boolean </a> + <a href="#attrs-instance_method" title="#attrs (instance method)">#<strong>attrs</strong> ⇒ Hash<Symbol, Value> </a> @@ -351,7 +437,7 @@ <span class="summary_desc"><div class='inline'> -<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its data.</p> +<p>A hash, where all the keys are attributes linked to their respective values.</p> </div></span> </li> @@ -360,7 +446,7 @@ <li class="public "> <span class="summary_signature"> - <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> ⇒ Array<Component> </a> + <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong> ⇒ Boolean </a> @@ -375,7 +461,7 @@ <span class="summary_desc"><div class='inline'> -<p>Entities that have this component.</p> +<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span> and data.</p> </div></span> </li> @@ -384,7 +470,7 @@ <li class="public "> <span class="summary_signature"> - <a href="#entity-instance_method" title="#entity (instance method)">#<strong>entity</strong> ⇒ Component </a> + <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> ⇒ Array<Integer> </a> @@ -399,7 +485,7 @@ <span class="summary_desc"><div class='inline'> -<p>A single entity.</p> +<p>A list of entity ids that are linked to the component.</p> </div></span> </li> @@ -434,7 +520,7 @@ <li class="public "> <span class="summary_signature"> - <a href="#to_h-instance_method" title="#to_h (instance method)">#<strong>to_h</strong> ⇒ Hash<Symbol, Value> </a> + <a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> ⇒ Integer </a> @@ -449,7 +535,7 @@ <span class="summary_desc"><div class='inline'> -<p>A hash, where all the keys are attributes linked to their respective values.</p> +<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID Reader</a></span>.</p> </div></span> </li> @@ -531,6 +617,11 @@ <pre class="lines"> +104 +105 +106 +107 +108 109 110 111 @@ -547,21 +638,26 @@ 122</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 109</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 104</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span> <span class='comment'># Prepare the object </span> <span class='comment'># (this is a function created with metaprogramming -</span> <span class='comment'># in FelFlame::Components) +</span> <span class='comment'># in FelFlame::Components </span> <span class='id identifier rubyid_set_defaults'>set_defaults</span> + <span class='comment'># Generate ID +</span> <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span> + <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> + <span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span> + <span class='comment'># Fill params </span> <span class='id identifier rubyid_attrs'>attrs</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>end</span> <span class='comment'># Save Component -</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span> +</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_new_id'>new_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span> <span class='kw'>end</span></pre> </td> </tr> @@ -614,12 +710,12 @@ <pre class="lines"> -159 -160 -161</pre> +136 +137 +138</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 159</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 136</span> <span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span> <span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> @@ -670,12 +766,12 @@ <pre class="lines"> -175 -176 -177</pre> +152 +153 +154</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 175</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 152</span> <span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span> <span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> @@ -726,12 +822,12 @@ <pre class="lines"> -167 -168 -169</pre> +144 +145 +146</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 167</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 144</span> <span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span> <span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> @@ -787,12 +883,12 @@ <pre class="lines"> -86 -87 -88</pre> +81 +82 +83</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 86</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 81</span> <span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span> <span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> @@ -843,12 +939,12 @@ <pre class="lines"> -102 -103 -104</pre> +97 +98 +99</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 102</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 97</span> <span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span> <span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> @@ -859,6 +955,62 @@ </div> + <span id="id=-instance_method"></span> + <div class="method_details "> + <h3 class="signature " id="id-instance_method"> + + #<strong>id</strong> ⇒ <tt>Integer</tt> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + +<p>Holds the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span> of a component. The <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span> is only unique within the scope of the component manager it was created from.</p> + + + </div> +</div> +<div class="tags"> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Integer</tt>)</span> + + + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +63 +64 +65</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 63</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span> + <span class='ivar'>@id</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <span id="removal_triggers=-instance_method"></span> <div class="method_details "> <h3 class="signature " id="removal_triggers-instance_method"> @@ -899,12 +1051,12 @@ <pre class="lines"> -94 -95 -96</pre> +89 +90 +91</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 94</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 89</span> <span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span> <span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> @@ -917,6 +1069,149 @@ </div> + <div id="class_method_details" class="method_details_list"> + <h2>Class Method Details</h2> + + + <div class="method_details first"> + <h3 class="signature first" id="[]-class_method"> + + .<strong>[]</strong>(component_id) ⇒ <tt>Component</tt> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + +<p>Gets a Component from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">unique ID</a></span>. Usage is simular to how an Array lookup works.</p> + + + </div> +</div> +<div class="tags"> + + <div class="examples"> + <p class="tag_title">Examples:</p> + + + <pre class="example code"><code><span class='comment'># this gets the 'Health' Component with ID 7 +</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="FelFlame::Components (class)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span></code></pre> + + </div> +<p class="tag_title">Parameters:</p> +<ul class="param"> + + <li> + + <span class='name'>component_id</span> + + + <span class='type'>(<tt>Integer</tt>)</span> + + + + </li> + +</ul> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Component</tt>)</span> + + + + — + <div class='inline'> +<p>Returns the Component that uses the given unique <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span>, nil if there is no Component associated with the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span></p> +</div> + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +169 +170 +171</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 169</span> + +<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rparen'>)</span> + <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_id'>component_id</span><span class='rbracket'>]</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="each-class_method"> + + .<strong>each</strong>(&block) ⇒ <tt>Enumerator</tt> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + +<p>Iterates over all components within the component manager. Special Enumerable methods like <code>map</code> or <code>each_with_index</code> are not implemented</p> + + + </div> +</div> +<div class="tags"> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Enumerator</tt>)</span> + + + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +176 +177 +178</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 176</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> + <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</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> @@ -965,18 +1260,18 @@ <pre class="lines"> -213 -214 -215 -216 -217 -218 -219 -220 -221</pre> +203 +204 +205 +206 +207 +208 +209 +210 +211</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 213</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 203</span> <span class='kw'>def</span> <span class='id identifier rubyid_attr_changed_trigger_systems'>attr_changed_trigger_systems</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span> <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> @@ -984,7 +1279,7 @@ <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span> <span class='op'>|=</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> - <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:priority</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reverse_each'>reverse_each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:call</span><span class='rparen'>)</span> + <span class='id identifier rubyid_systems_to_execute'>systems_to_execute</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:priority</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>true</span> <span class='kw'>end</span></pre> </td> @@ -993,9 +1288,9 @@ </div> <div class="method_details "> - <h3 class="signature " id="delete-instance_method"> + <h3 class="signature " id="attrs-instance_method"> - #<strong>delete</strong> ⇒ <tt>Boolean</tt> + #<strong>attrs</strong> ⇒ <tt>Hash<Symbol, Value></tt> @@ -1004,7 +1299,7 @@ </h3><div class="docstring"> <div class="discussion"> -<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its data.</p> +<p>Returns A hash, where all the keys are attributes linked to their respective values.</p> </div> @@ -1017,13 +1312,13 @@ <li> - <span class='type'>(<tt>Boolean</tt>)</span> + <span class='type'>(<tt>Hash<Symbol, Value></tt>)</span> — <div class='inline'> -<p><code>true</code>.</p> +<p>A hash, where all the keys are attributes linked to their respective values.</p> </div> </li> @@ -1036,35 +1331,23 @@ <pre class="lines"> -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 235 -236</pre> +236 +237 +238 +239 +240 +241</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 224</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 235</span> -<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span> - <span class='id identifier rubyid_addition_triggers'>addition_triggers</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_system'>system</span><span class='op'>|</span> - <span class='id identifier rubyid_system'>system</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='label'>component_or_manager:</span> <span class='kw'>self</span> - <span class='kw'>end</span> - <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_reverse_each'>reverse_each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_entity'>entity</span><span class='op'>|</span> - <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span> <span class='kw'>self</span> - <span class='kw'>end</span> - <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid__data'>_data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span> - <span class='id identifier rubyid_instance_variables'>instance_variables</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_var'>var</span><span class='op'>|</span> - <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> +<span class='kw'>def</span> <span class='id identifier rubyid_attrs'>attrs</span> + <span class='id identifier rubyid_return_hash'>return_hash</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_final'>final</span><span class='op'>|</span> + <span class='id identifier rubyid_final'>final</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_delete_prefix'>delete_prefix</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>@</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='kw'>end</span> - <span class='kw'>true</span> + <span class='id identifier rubyid_return_hash'>return_hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:attr_triggers</span><span class='rparen'>)</span> + <span class='id identifier rubyid_return_hash'>return_hash</span> <span class='kw'>end</span></pre> </td> </tr> @@ -1072,9 +1355,9 @@ </div> <div class="method_details "> - <h3 class="signature " id="entities-instance_method"> + <h3 class="signature " id="delete-instance_method"> - #<strong>entities</strong> ⇒ <tt>Array<Component></tt> + #<strong>delete</strong> ⇒ <tt>Boolean</tt> @@ -1083,7 +1366,7 @@ </h3><div class="docstring"> <div class="discussion"> -<p>Entities that have this component</p> +<p>Removes this component from the list and purges all references to this Component from other Entities, as well as its <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID</a></span> and data.</p> </div> @@ -1096,10 +1379,15 @@ <li> - <span class='type'>(<tt>Array<Component></tt>)</span> + <span class='type'>(<tt>Boolean</tt>)</span> + — + <div class='inline'> +<p><code>true</code>.</p> +</div> + </li> </ul> @@ -1110,15 +1398,45 @@ <pre class="lines"> -188 -189 -190</pre> +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 188</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 215</span> -<span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span> - <span class='ivar'>@entities</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> +<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span> + <span class='id identifier rubyid_addition_triggers'>addition_triggers</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_system'>system</span><span class='op'>|</span> + <span class='id identifier rubyid_system'>system</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='label'>component_or_manager:</span> <span class='kw'>self</span> + <span class='kw'>end</span> + <span class='comment'># This needs to be cloned because indices get deleted as +</span> <span class='comment'># the remove command is called, breaking the loop if it +</span> <span class='comment'># wasn't referencing a clone(will get Nil errors) +</span> <span class='id identifier rubyid_iter'>iter</span> <span class='op'>=</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:clone</span><span class='rparen'>)</span> + <span class='id identifier rubyid_iter'>iter</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_entity'>entity</span><span class='op'>|</span> + <span class='comment'>#FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil? +</span> <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span> <span class='kw'>self</span> + <span class='kw'>end</span> + <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span> + <span class='id identifier rubyid_instance_variables'>instance_variables</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_var'>var</span><span class='op'>|</span> + <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> + <span class='kw'>end</span> + <span class='kw'>true</span> <span class='kw'>end</span></pre> </td> </tr> @@ -1126,9 +1444,9 @@ </div> <div class="method_details "> - <h3 class="signature " id="entity-instance_method"> + <h3 class="signature " id="entities-instance_method"> - #<strong>entity</strong> ⇒ <tt>Component</tt> + #<strong>entities</strong> ⇒ <tt>Array<Integer></tt> @@ -1137,7 +1455,7 @@ </h3><div class="docstring"> <div class="discussion"> -<p>A single entity. Use this if you expect the component to only belong to one entity and you want to access it.</p> +<p>A list of entity ids that are linked to the component</p> </div> @@ -1150,7 +1468,7 @@ <li> - <span class='type'>(<tt>Component</tt>)</span> + <span class='type'>(<tt>Array<Integer></tt>)</span> @@ -1164,25 +1482,15 @@ <pre class="lines"> -194 -195 -196 -197 -198 -199 -200 -201</pre> +189 +190 +191</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 194</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 189</span> -<span class='kw'>def</span> <span class='id identifier rubyid_entity'>entity</span> - <span class='kw'>if</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> - <span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This component belongs to NO entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> - <span class='kw'>elsif</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>1</span> - <span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This component belongs to MANY entities but you called the method that is intended for components belonging to a single entity.\nYou may have a bug in your logic.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> - <span class='kw'>end</span> - <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> +<span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span> + <span class='ivar'>@entities</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>end</span></pre> </td> </tr> @@ -1190,9 +1498,9 @@ </div> <div class="method_details "> - <h3 class="signature " id="to_h-instance_method"> + <h3 class="signature " id="to_i-instance_method"> - #<strong>to_h</strong> ⇒ <tt>Hash<Symbol, Value></tt> + #<strong>to_i</strong> ⇒ <tt>Integer</tt> @@ -1201,7 +1509,7 @@ </h3><div class="docstring"> <div class="discussion"> -<p>Returns A hash, where all the keys are attributes linked to their respective values.</p> +<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::ComponentManager#id (method)">ID Reader</a></span></p> </div> @@ -1214,14 +1522,9 @@ <li> - <span class='type'>(<tt>Hash<Symbol, Value></tt>)</span> - + <span class='type'>(<tt>Integer</tt>)</span> - — - <div class='inline'> -<p>A hash, where all the keys are attributes linked to their respective values.</p> -</div> </li> @@ -1233,23 +1536,15 @@ <pre class="lines"> -239 -240 -241 -242 -243 -244 -245</pre> +183 +184 +185</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 239</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 183</span> -<span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span> - <span class='id identifier rubyid_return_hash'>return_hash</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variables'>instance_variables</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_final'>final</span><span class='op'>|</span> - <span class='id identifier rubyid_final'>final</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_delete_prefix'>delete_prefix</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>@</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> - <span class='kw'>end</span> - <span class='id identifier rubyid_return_hash'>return_hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:attr_triggers</span><span class='rparen'>)</span> - <span class='id identifier rubyid_return_hash'>return_hash</span> +<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span> + <span class='id identifier rubyid_id'>id</span> <span class='kw'>end</span></pre> </td> </tr> @@ -1300,14 +1595,14 @@ <pre class="lines"> -205 -206 -207 -208 -209</pre> +195 +196 +197 +198 +199</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 205</span> + <pre class="code"><span class="info file"># File 'lib/felflame/component_manager.rb', line 195</span> <span class='kw'>def</span> <span class='id identifier rubyid_update_attrs'>update_attrs</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='id identifier rubyid_opts'>opts</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> @@ -1324,7 +1619,7 @@ </div> <div id="footer"> - Generated on Thu Dec 30 07:28:06 2021 by + Generated on Mon Jul 12 18:28:27 2021 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.26 (ruby-2.7.3). </div> |
