Class: Jekyll::FastReader::AnchorCalculator
- Inherits:
-
Object
- Object
- Jekyll::FastReader::AnchorCalculator
- Defined in:
- lib/jekyll/fast_reader/anchor_calculator.rb
Constant Summary collapse
- BUCKET_MAP =
{ 1 => 1, 2 => 1, 3 => 1, 4 => 2, 5 => 2, 6 => 2, 7 => 3, 8 => 3, 9 => 3 }.freeze
- LONG_WORD_RATIO =
0.4
Class Method Summary collapse
Class Method Details
.anchor_length(word_length) ⇒ Object
18 19 20 |
# File 'lib/jekyll/fast_reader/anchor_calculator.rb', line 18 def self.anchor_length(word_length) BUCKET_MAP.fetch(word_length) { (word_length * LONG_WORD_RATIO).ceil } end |