<!DOCTYPE html>
<html> <head> <meta content=“text/html; charset=UTF-8” http-equiv=“Content-Type”>
<title>class ReVIEW::Book::Volume - review-2.1.0 Documentation</title>
<link type=“text/css” media=“screen” href=“../../rdoc.css” rel=“stylesheet”>
<script type=“text/javascript”>
var rdoc_rel_prefix = "../../";
</script>
<script type=“text/javascript” charset=“utf-8” src=“../../js/jquery.js”></script> <script type=“text/javascript” charset=“utf-8” src=“../../js/navigation.js”></script> <script type=“text/javascript” charset=“utf-8” src=“../../js/search_index.js”></script> <script type=“text/javascript” charset=“utf-8” src=“../../js/search.js”></script> <script type=“text/javascript” charset=“utf-8” src=“../../js/searcher.js”></script> <script type=“text/javascript” charset=“utf-8” src=“../../js/darkfish.js”></script>
<body id=“top” class=“class”> <nav id=“metadata”>
<nav id="home-section" class="section"> <h3 class="section-header"> <a href="../../index.html">Home</a> <a href="../../table_of_contents.html#classes">Classes</a> <a href="../../table_of_contents.html#methods">Methods</a> </h3>
</nav>
<nav id="search-section" class="section project-section" class="initially-hidden"> <form action="#" method="get" accept-charset="utf-8"> <h3 class="section-header"> <input type="text" name="search" placeholder="Search" id="search-field" title="Type to search, Up and Down to navigate, Enter to load"> </h3> </form> <ul id="search-results" class="initially-hidden"></ul>
</nav>
<div id="file-metadata"> <nav id="file-list-section" class="section"> <h3 class="section-header">Defined In</h3> <ul> <li>lib/review/book/volume.rb </ul>
</nav>
</div> <div id="class-metadata"> <nav id="parent-class-section" class="section"> <h3 class="section-header">Parent</h3> <p class="link"><a href="../../Object.html">Object</a>
</nav>
<!-- Method Quickref -->
<nav id=“method-list-section” class=“section”>
<h3 class="section-header">Methods</h3> <ul class="link-list"> <li ><a href="#method-c-count_file">::count_file</a> <li ><a href="#method-c-dummy">::dummy</a> <li ><a href="#method-c-new">::new</a> <li ><a href="#method-c-sum">::sum</a> <li ><a href="#method-i-2B">#+</a> <li ><a href="#method-i-kbytes">#kbytes</a> <li ><a href="#method-i-page">#page</a> <li ><a href="#method-i-to_s">#to_s</a> </ul>
</nav>
</div> <div id="project-metadata"> <nav id="fileindex-section" class="section project-section"> <h3 class="section-header">Pages</h3> <ul> <li class="file"><a href="../../ChangeLog.html">ChangeLog</a> </ul>
</nav>
<nav id="classindex-section" class="section project-section"> <h3 class="section-header">Class and Module Index</h3> <ul class="link-list"> <li><a href="../../EPUBMaker.html">EPUBMaker</a> <li><a href="../../EPUBMaker/Content.html">EPUBMaker::Content</a> <li><a href="../../EPUBMaker/EPUBCommon.html">EPUBMaker::EPUBCommon</a> <li><a href="../../EPUBMaker/EPUBv2.html">EPUBMaker::EPUBv2</a> <li><a href="../../EPUBMaker/EPUBv3.html">EPUBMaker::EPUBv3</a> <li><a href="../../EPUBMaker/Producer.html">EPUBMaker::Producer</a> <li><a href="../../Encoding.html">Encoding</a> <li><a href="../../Hash.html">Hash</a> <li><a href="../../LineInput.html">LineInput</a> <li><a href="../../Object.html">Object</a> <li><a href="../../ReVIEW.html">ReVIEW</a> <li><a href="../../ReVIEW/ApplicationError.html">ReVIEW::ApplicationError</a> <li><a href="../../ReVIEW/Book.html">ReVIEW::Book</a> <li><a href="../../ReVIEW/Book/Base.html">ReVIEW::Book::Base</a> <li><a href="../../ReVIEW/Book/BibpaperIndex.html">ReVIEW::Book::BibpaperIndex</a> <li><a href="../../ReVIEW/Book/Chapter.html">ReVIEW::Book::Chapter</a> <li><a href="../../ReVIEW/Book/ChapterIndex.html">ReVIEW::Book::ChapterIndex</a> <li><a href="../../ReVIEW/Book/ColumnIndex.html">ReVIEW::Book::ColumnIndex</a> <li><a href="../../ReVIEW/Book/Compilable.html">ReVIEW::Book::Compilable</a> <li><a href="../../ReVIEW/Book/FootnoteIndex.html">ReVIEW::Book::FootnoteIndex</a> <li><a href="../../ReVIEW/Book/HeadlineIndex.html">ReVIEW::Book::HeadlineIndex</a> <li><a href="../../ReVIEW/Book/IconIndex.html">ReVIEW::Book::IconIndex</a> <li><a href="../../ReVIEW/Book/ImageFinder.html">ReVIEW::Book::ImageFinder</a> <li><a href="../../ReVIEW/Book/ImageIndex.html">ReVIEW::Book::ImageIndex</a> <li><a href="../../ReVIEW/Book/ImageIndex/Item.html">ReVIEW::Book::ImageIndex::Item</a> <li><a href="../../ReVIEW/Book/IndepImageIndex.html">ReVIEW::Book::IndepImageIndex</a> <li><a href="../../ReVIEW/Book/IndepImageIndex/Item.html">ReVIEW::Book::IndepImageIndex::Item</a> <li><a href="../../ReVIEW/Book/Index.html">ReVIEW::Book::Index</a> <li><a href="../../ReVIEW/Book/ListIndex.html">ReVIEW::Book::ListIndex</a> <li><a href="../../ReVIEW/Book/NumberlessImageIndex.html">ReVIEW::Book::NumberlessImageIndex</a> <li><a href="../../ReVIEW/Book/NumberlessImageIndex/Item.html">ReVIEW::Book::NumberlessImageIndex::Item</a> <li><a href="../../ReVIEW/Book/PageMetric.html">ReVIEW::Book::PageMetric</a> <li><a href="../../ReVIEW/Book/Part.html">ReVIEW::Book::Part</a> <li><a href="../../ReVIEW/Book/TableIndex.html">ReVIEW::Book::TableIndex</a> <li><a href="../../ReVIEW/Book/Volume.html">ReVIEW::Book::Volume</a> <li><a href="../../ReVIEW/Builder.html">ReVIEW::Builder</a> <li><a href="../../ReVIEW/Catalog.html">ReVIEW::Catalog</a> <li><a href="../../ReVIEW/CompileError.html">ReVIEW::CompileError</a> <li><a href="../../ReVIEW/Compiler.html">ReVIEW::Compiler</a> <li><a href="../../ReVIEW/Compiler/InlineSyntaxElement.html">ReVIEW::Compiler::InlineSyntaxElement</a> <li><a href="../../ReVIEW/Compiler/SyntaxElement.html">ReVIEW::Compiler::SyntaxElement</a> <li><a href="../../ReVIEW/ConfigError.html">ReVIEW::ConfigError</a> <li><a href="../../ReVIEW/Configure.html">ReVIEW::Configure</a> <li><a href="../../ReVIEW/Converter.html">ReVIEW::Converter</a> <li><a href="../../ReVIEW/EPUBBuilder.html">ReVIEW::EPUBBuilder</a> <li><a href="../../ReVIEW/EPUBMaker.html">ReVIEW::EPUBMaker</a> <li><a href="../../ReVIEW/EPUBMaker/ReVIEWHeaderListener.html">ReVIEW::EPUBMaker::ReVIEWHeaderListener</a> <li><a href="../../ReVIEW/EWBBuilder.html">ReVIEW::EWBBuilder</a> <li><a href="../../ReVIEW/Error.html">ReVIEW::Error</a> <li><a href="../../ReVIEW/ErrorUtils.html">ReVIEW::ErrorUtils</a> <li><a href="../../ReVIEW/FileNotFound.html">ReVIEW::FileNotFound</a> <li><a href="../../ReVIEW/HTMLBuilder.html">ReVIEW::HTMLBuilder</a> <li><a href="../../ReVIEW/HTMLTOCPrinter.html">ReVIEW::HTMLTOCPrinter</a> <li><a href="../../ReVIEW/HTMLToc.html">ReVIEW::HTMLToc</a> <li><a href="../../ReVIEW/HTMLUtils.html">ReVIEW::HTMLUtils</a> <li><a href="../../ReVIEW/I18n.html">ReVIEW::I18n</a> <li><a href="../../ReVIEW/IDGXMLBuilder.html">ReVIEW::IDGXMLBuilder</a> <li><a href="../../ReVIEW/KeyError.html">ReVIEW::KeyError</a> <li><a href="../../ReVIEW/LATEXBuilder.html">ReVIEW::LATEXBuilder</a> <li><a href="../../ReVIEW/LaTeXIndex.html">ReVIEW::LaTeXIndex</a> <li><a href="../../ReVIEW/LaTeXUtils.html">ReVIEW::LaTeXUtils</a> <li><a href="../../ReVIEW/Line.html">ReVIEW::Line</a> <li><a href="../../ReVIEW/LineInput.html">ReVIEW::LineInput</a> <li><a href="../../ReVIEW/Location.html">ReVIEW::Location</a> <li><a href="../../ReVIEW/MARKDOWNBuilder.html">ReVIEW::MARKDOWNBuilder</a> <li><a href="../../ReVIEW/MD2INAOBuilder.html">ReVIEW::MD2INAOBuilder</a> <li><a href="../../ReVIEW/MakerHelper.html">ReVIEW::MakerHelper</a> <li><a href="../../ReVIEW/PDFMaker.html">ReVIEW::PDFMaker</a> <li><a href="../../ReVIEW/Preprocessor.html">ReVIEW::Preprocessor</a> <li><a href="../../ReVIEW/Preprocessor/Directive.html">ReVIEW::Preprocessor::Directive</a> <li><a href="../../ReVIEW/Preprocessor/Strip.html">ReVIEW::Preprocessor::Strip</a> <li><a href="../../ReVIEW/Repository.html">ReVIEW::Repository</a> <li><a href="../../ReVIEW/SecCounter.html">ReVIEW::SecCounter</a> <li><a href="../../ReVIEW/SyntaxError.html">ReVIEW::SyntaxError</a> <li><a href="../../ReVIEW/TEXTBuilder.html">ReVIEW::TEXTBuilder</a> <li><a href="../../ReVIEW/TOCParser.html">ReVIEW::TOCParser</a> <li><a href="../../ReVIEW/TOCParser/Chapter.html">ReVIEW::TOCParser::Chapter</a> <li><a href="../../ReVIEW/TOCParser/List.html">ReVIEW::TOCParser::List</a> <li><a href="../../ReVIEW/TOCParser/Node.html">ReVIEW::TOCParser::Node</a> <li><a href="../../ReVIEW/TOCParser/Paragraph.html">ReVIEW::TOCParser::Paragraph</a> <li><a href="../../ReVIEW/TOCParser/Section.html">ReVIEW::TOCParser::Section</a> <li><a href="../../ReVIEW/TOCPrinter.html">ReVIEW::TOCPrinter</a> <li><a href="../../ReVIEW/TOPBuilder.html">ReVIEW::TOPBuilder</a> <li><a href="../../ReVIEW/Template.html">ReVIEW::Template</a> <li><a href="../../ReVIEW/TextTOCPrinter.html">ReVIEW::TextTOCPrinter</a> <li><a href="../../ReVIEW/TextUtils.html">ReVIEW::TextUtils</a> <li><a href="../../ReVIEW/Unfold.html">ReVIEW::Unfold</a> <li><a href="../../ReVIEW/WEBMaker.html">ReVIEW::WEBMaker</a> <li><a href="../../ReVIEW/WEBTOCPrinter.html">ReVIEW::WEBTOCPrinter</a> <li><a href="../../ReVIEW/WrongInput.html">ReVIEW::WrongInput</a> <li><a href="../../ReVIEW/YAMLLoader.html">ReVIEW::YAMLLoader</a> <li><a href="../../String.html">String</a> </ul>
</nav>
</div>
</nav>
<div id=“documentation”>
<h1 class="class">class ReVIEW::Book::Volume</h1> <div id="description" class="description"> </div><!-- description --> <section id="5Buntitled-5D" class="documentation-section"> <!-- Attributes --> <section id="attribute-method-details" class="method-section section"> <h3 class="section-header">Attributes</h3> <div id="attribute-i-bytes" class="method-detail"> <div class="method-heading attribute-method-heading"> <span class="method-name">bytes</pan><span class="attribute-access-type">[R]</span> </div> <div class="method-description"> </div> </div> <div id="attribute-i-chars" class="method-detail"> <div class="method-heading attribute-method-heading"> <span class="method-name">chars</span><span class="attribute-access-type">[R]</pan> </div> <div class="method-description"> </div> </div> <div id="attribute-i-lines" class="method-detail"> <div class="method-heading attribute-method-heading"> <span class="method-name">lines</pan><span class="attribute-access-type">[RW]</span> </div> <div class="method-description"> </div> </div> <div id="attribute-i-page_per_kbyte" class="method-detail"> <div class="method-heading attribute-method-heading"> <span class="method-name">page_per_kbyte</span><span class="attribute-access-type">[RW]</pan> </div> <div class="method-description"> </div> </div> </ection><!-- attribute-method-details --> <!-- Methods --> <section id="public-class-5Buntitled-5D-method-details" class="method-section section"> <h3 class="section-header">Public Class Methods</h3> <div id="method-c-count_file" class="method-detail "> <div class="method-heading"> <span class="method-name">count_file</pan><span class="method-args">(path)</span> <span class="method-click-advice">click to toggle source</pan> </div> <div class="method-description"> <div class="method-source-code" id="count_file-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 15</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-constant”>Volume</span>.<span class=“ruby-identifier”>count_file</span>(<span class=“ruby-identifier”>path</span>)
<span class="ruby-identifier">b</span> = <span class="ruby-identifier">c</span> = <span class="ruby-identifier">l</span> = <span class="ruby-value">0</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">foreach</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-node">%r<\A\#@></span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">line</span> <span class="ruby-identifier">text</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\s+/</span>, <span class="ruby-string">''</span>) <span class="ruby-identifier">b</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">bytesize</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">charsize</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">end</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">b</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">l</span>)
<span class=“ruby-keyword”>end</span></pre>
</div><!-- count_file-source --> </div> </div><!-- count_file-method --> <div id="method-c-dummy" class="method-detail "> <div class="method-heading"> <span class="method-name">dummy</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="dummy-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 31</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-constant”>Volume</span>.<span class=“ruby-identifier”>dummy</span>
<span class="ruby-identifier">new</span>(<span class="ruby-value">-1</span>, <span class="ruby-value">-1</span>, <span class="ruby-value">-1</span>)
<span class=“ruby-keyword”>end</span></pre>
</div><!-- dummy-source --> </div> </div><!-- dummy-method --> <div id="method-c-new" class="method-detail "> <div class="method-heading"> <span class="method-name">new</span><span class="method-args">(bytes = 0, chars = 0, lines = 0)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="new-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 35</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-identifier”>initialize</span>(<span class=“ruby-identifier”>bytes</span> = <span class=“ruby-value”>0</span>, <span class=“ruby-identifier”>chars</span> = <span class=“ruby-value”>0</span>, <span class=“ruby-identifier”>lines</span> = <span class=“ruby-value”>0</span>)
<span class="ruby-ivar">@bytes</span> = <span class="ruby-identifier">bytes</span> <span class="ruby-ivar">@chars</span> = <span class="ruby-identifier">chars</span> <span class="ruby-ivar">@lines</span> = <span class="ruby-identifier">lines</span> <span class="ruby-ivar">@page_per_kbyte</span> = <span class="ruby-keyword">nil</span>
<span class=“ruby-keyword”>end</span></pre>
</div><!-- new-source --> </div> </div><!-- new-method --> <div id="method-c-sum" class="method-detail "> <div class="method-heading"> <span class="method-name">sum</span><span class="method-args">(vols)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="sum-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 27</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-constant”>Volume</span>.<span class=“ruby-identifier”>sum</span>(<span class=“ruby-identifier”>vols</span>)
<span class="ruby-identifier">vols</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">new</span>()) {<span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span> }
<span class=“ruby-keyword”>end</span></pre>
</div><!-- sum-source --> </div> </div><!-- sum-method --> </section><!-- public-class-method-details --> <section id="public-instance-5Buntitled-5D-method-details" class="method-section section"> <h3 class="section-header">Public Instance Methods</h3> <div id="method-i-2B" class="method-detail "> <div class="method-heading"> <span class="method-name">+</span><span class="method-args">(other)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="2B-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 59</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-operator”>+</span>(<span class=“ruby-identifier”>other</span>)
<span class="ruby-constant">Volume</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@bytes</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">bytes</span>, <span class="ruby-ivar">@chars</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">chars</span>, <span class="ruby-ivar">@lines</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">lines</span>)
<span class=“ruby-keyword”>end</span></pre>
</div><!-- 2B-source --> </div> </div><!-- 2B-method --> <div id="method-i-kbytes" class="method-detail "> <div class="method-heading"> <span class="method-name">kbytes</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="kbytes-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 47</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-identifier”>kbytes</span>
(<span class="ruby-ivar">@bytes</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span>).<span class="ruby-identifier">ceil</span>
<span class=“ruby-keyword”>end</span></pre>
</div><!-- kbytes-source --> </div> </div><!-- kbytes-method --> <div id="method-i-page" class="method-detail "> <div class="method-heading"> <span class="method-name">page</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="page-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 51</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-identifier”>page</span>
(<span class="ruby-identifier">kbytes</span>.<span class="ruby-identifier">to_f</span><span class="ruby-operator">/</span><span class="ruby-ivar">@page_per_kbyte</span>).<span class="ruby-identifier">ceil</span>
<span class=“ruby-keyword”>end</span></pre>
</div><!-- page-source --> </div> </div><!-- page-method --> <div id="method-i-to_s" class="method-detail "> <div class="method-heading"> <span class="method-name">to_s</span><span class="method-args">()</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <div class="method-source-code" id="to_s-source"> <pre><span class="ruby-comment"># File lib/review/book/volume.rb, line 55</span>
<span class=“ruby-keyword”>def</span> <span class=“ruby-identifier”>to_s</span>
<span class="ruby-node">"#{kbytes()}KB #{@chars}C #{@lines}L #{page()}P"</span>
<span class=“ruby-keyword”>end</span></pre>
</div><!-- to_s-source --> </div> </div><!-- to_s-method --> </section><!-- public-instance-method-details --> </section><!-- 5Buntitled-5D -->
</div><!– documentation –>
<footer id=“validator-badges”>
<p><a href="http://validator.w3.org/check/referer">[Validate]</a> <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0. <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>