Class: VivlioStarter::CLI::IndexCommands::IndexSizeEstimator::Estimate
- Inherits:
-
Data
- Object
- Data
- VivlioStarter::CLI::IndexCommands::IndexSizeEstimator::Estimate
- Defined in:
- lib/vivlio_starter/cli/index/index_size_estimator.rb
Overview
算出結果。range は目安語数の幅(整数指定なら 1 点の範囲になる)。
Instance Attribute Summary collapse
-
#chars ⇒ Object
readonly
Returns the value of attribute chars.
-
#preset ⇒ Object
readonly
Returns the value of attribute preset.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
-
#chars_per_term_range ⇒ Object
「約 N 字に 1 語」。著者は密度で考えるので、語数と密度を併記するための値。 語数が多いほど 1 語あたりの字数は小さくなるので、上下が入れ替わる。.
- #to_s ⇒ Object
Instance Attribute Details
#chars ⇒ Object (readonly)
Returns the value of attribute chars
56 57 58 |
# File 'lib/vivlio_starter/cli/index/index_size_estimator.rb', line 56 def chars @chars end |
#preset ⇒ Object (readonly)
Returns the value of attribute preset
56 57 58 |
# File 'lib/vivlio_starter/cli/index/index_size_estimator.rb', line 56 def preset @preset end |
#range ⇒ Object (readonly)
Returns the value of attribute range
56 57 58 |
# File 'lib/vivlio_starter/cli/index/index_size_estimator.rb', line 56 def range @range end |
Instance Method Details
#chars_per_term_range ⇒ Object
「約 N 字に 1 語」。著者は密度で考えるので、語数と密度を併記するための値。 語数が多いほど 1 語あたりの字数は小さくなるので、上下が入れ替わる。
59 60 61 62 63 |
# File 'lib/vivlio_starter/cli/index/index_size_estimator.rb', line 59 def chars_per_term_range return (0..0) if range.end.zero? ((chars / range.end)..(chars / [range.begin, 1].max)) end |
#to_s ⇒ Object
65 |
# File 'lib/vivlio_starter/cli/index/index_size_estimator.rb', line 65 def to_s = range.begin == range.end ? "#{range.begin} 語" : "#{range.begin}〜#{range.end} 語" |