lib/review/book/base.rb in review-4.1.0 vs lib/review/book/base.rb in review-4.2.0
- old
+ new
@@ -77,11 +77,11 @@
end
def page_metric
if config['page_metric'].respond_to?(:downcase) && config['page_metric'].upcase =~ /\A[A-Z0-9_]+\Z/
ReVIEW::Book::PageMetric.const_get(config['page_metric'].upcase)
- elsif config['page_metric'].is_a?(Array) && config['page_metric'].size == 5
+ elsif config['page_metric'].is_a?(Array) && (config['page_metric'].size == 5 || config['page_metric'].size == 4)
ReVIEW::Book::PageMetric.new(*config['page_metric'])
else
config['page_metric']
end
end
@@ -173,12 +173,10 @@
end
nil # not found
end
def volume
- vol = Volume.sum(chapters.map(&:volume))
- vol.page_per_kbyte = page_metric.page_per_kbyte
- vol
+ Volume.sum(parts.map(&:volume) + chapters.map(&:volume))
end
def load_config(filename)
new_conf = YAML.load_file(filename)
@config.merge!(new_conf)