rdoc/RubyXL/GenericStorageObject.html in rubyXL-3.2.0 vs rdoc/RubyXL/GenericStorageObject.html in rubyXL-3.2.1
- old
+ new
@@ -2,11 +2,11 @@
<html>
<head>
<meta charset="UTF-8">
-<title>class RubyXL::GenericStorageObject - rubyXL 3.2.0</title>
+<title>class RubyXL::GenericStorageObject - rubyXL 3.2.1</title>
<link href="../fonts.css" rel="stylesheet">
<link href="../rdoc.css" rel="stylesheet">
<script type="text/javascript">
@@ -176,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">(file_path)</span>
+ class="method-args">(file_path, data)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
@@ -192,14 +192,14 @@
<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-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">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file_path</span>, <span class="ruby-identifier">data</span>)
+ <span class="ruby-ivar">@xlsx_path</span> = <span class="ruby-identifier">file_path</span>
+ <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">data</span>
+ <span class="ruby-ivar">@generic_storage</span> = []
<span class="ruby-keyword">end</span></pre>
</div>
</div>
@@ -211,11 +211,11 @@
<div id="method-c-parse_file" class="method-detail ">
<div class="method-heading">
<span class="method-name">parse_file</span><span
- class="method-args">(dirpath, file_path = nil)</span>
+ class="method-args">(zip_file, file_path)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
@@ -227,27 +227,12 @@
<div class="method-source-code" id="parse_file-source">
<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">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-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">"/"</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'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-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_file</span>(<span class="ruby-identifier">zip_file</span>, <span class="ruby-identifier">file_path</span>)
+ (<span class="ruby-identifier">entry</span> = <span class="ruby-identifier">zip_file</span>.<span class="ruby-identifier">find_entry</span>(<span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-identifier">from_root</span>(<span class="ruby-identifier">file_path</span>))) <span class="ruby-operator">&&</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file_path</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></pre>
</div>
</div>
@@ -282,16 +267,14 @@
<div class="method-source-code" id="add_to_zip-source">
- <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">"/"</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">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>)
+ <pre><span class="ruby-comment"># File lib/rubyXL/objects/storage.rb, line 18</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">zip_stream</span>.<span class="ruby-identifier">put_next_entry</span>(<span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-identifier">from_root</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">xlsx_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>
</div>