rdoc/RubyXL/GenericStorageObject.html in rubyXL-3.1.2 vs rdoc/RubyXL/GenericStorageObject.html in rubyXL-3.2.0

- old
+ new

@@ -2,11 +2,11 @@ <html> <head> <meta charset="UTF-8"> -<title>class RubyXL::GenericStorageObject - rubyXL 3.1.2</title> +<title>class RubyXL::GenericStorageObject - rubyXL 3.2.0</title> <link href="../fonts.css" rel="stylesheet"> <link href="../rdoc.css" rel="stylesheet"> <script type="text/javascript"> @@ -149,23 +149,10 @@ </div> </div> - <div id="attribute-i-workbook" class="method-detail"> - <div class="method-heading attribute-method-heading"> - <span class="method-name">workbook</span><span - class="attribute-access-type">[RW]</span> - </div> - - <div class="method-description"> - - - - </div> - </div> - <div id="attribute-i-xlsx_path" class="method-detail"> <div class="method-heading attribute-method-heading"> <span class="method-name">xlsx_path</span><span class="attribute-access-type">[RW]</span> </div> @@ -189,11 +176,11 @@ <div id="method-c-new" class="method-detail "> <div class="method-heading"> <span class="method-name">new</span><span - class="method-args">()</span> + class="method-args">(file_path)</span> <span class="method-click-advice">click to toggle source</span> </div> @@ -205,13 +192,12 @@ <div class="method-source-code" id="new-source"> <pre><span class="ruby-comment"># File lib/rubyXL/objects/storage.rb, line 8</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> - <span class="ruby-ivar">@workbook</span> = <span class="ruby-keyword">nil</span> - <span class="ruby-ivar">@xlsx_path</span> = <span class="ruby-keyword">nil</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file_path</span>) + <span class="ruby-ivar">@xlsx_path</span> = <span class="ruby-identifier">file_path</span> <span class="ruby-ivar">@data</span> = <span class="ruby-keyword">nil</span> <span class="ruby-ivar">@generic_storage</span> = [] <span class="ruby-keyword">end</span></pre> </div> @@ -240,27 +226,27 @@ <div class="method-source-code" id="parse_file-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/objects/storage.rb, line 15</span> + <pre><span class="ruby-comment"># File lib/rubyXL/objects/storage.rb, line 14</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_file</span>(<span class="ruby-identifier">dirpath</span>, <span class="ruby-identifier">file_path</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-identifier">file_path</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">xlsx_path</span> - <span class="ruby-identifier">obj</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">obj</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file_path</span>) <span class="ruby-keyword">case</span> <span class="ruby-identifier">dirpath</span> <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">full_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dirpath</span>, <span class="ruby-identifier">file_path</span>) <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">full_path</span>) - <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">data</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">full_path</span>, <span class="ruby-string">'r'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span> } + <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">data</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">full_path</span>, <span class="ruby-string">&#39;r&#39;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span> } <span class="ruby-keyword">when</span> <span class="ruby-constant">Zip</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span> <span class="ruby-keyword">then</span> + <span class="ruby-identifier">file_path</span> = <span class="ruby-identifier">file_path</span>.<span class="ruby-identifier">relative_path_from</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;/&quot;</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">file_path</span>.<span class="ruby-identifier">absolute?</span> <span class="ruby-comment"># Zip doesn&#39;t like absolute paths. </span> <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">dirpath</span>.<span class="ruby-identifier">find_entry</span>(<span class="ruby-identifier">file_path</span>) <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">data</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">get_input_stream</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span> } <span class="ruby-keyword">end</span> - <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">xlsx_path</span> = <span class="ruby-identifier">file_path</span> <span class="ruby-identifier">obj</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -296,14 +282,14 @@ <div class="method-source-code" id="add_to_zip-source"> - <pre><span class="ruby-comment"># File lib/rubyXL/objects/storage.rb, line 34</span> + <pre><span class="ruby-comment"># File lib/rubyXL/objects/storage.rb, line 33</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">add_to_zip</span>(<span class="ruby-identifier">zip_stream</span>) <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-identifier">path</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">xlsx_path</span> - <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">relative_path_from</span>(<span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;/&quot;</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">absolute?</span> <span class="ruby-comment"># Zip doesn't like absolute paths. </span> + <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">relative_path_from</span>(<span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;/&quot;</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">absolute?</span> <span class="ruby-comment"># Zip doesn&#39;t like absolute paths. </span> <span class="ruby-identifier">zip_stream</span>.<span class="ruby-identifier">put_next_entry</span>(<span class="ruby-identifier">path</span>) <span class="ruby-identifier">zip_stream</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@data</span>) <span class="ruby-keyword">end</span></pre> </div>