Class: Rundown::Processors::ReadingTime

Inherits:
Rundown::Processor show all
Defined in:
lib/rundown/processors/reading_time.rb

Constant Summary collapse

RATE =
0.312

Constants inherited from Rundown::Processor

Rundown::Processor::PUNCTUATION

Instance Attribute Summary collapse

Attributes inherited from Rundown::Processor

#text, #words

Instance Method Summary collapse

Methods inherited from Rundown::Processor

#sentences

Constructor Details

#initialize(words, reading_rate = RATE) ⇒ ReadingTime

Returns a new instance of ReadingTime.



8
9
10
11
# File 'lib/rundown/processors/reading_time.rb', line 8

def initialize(words, reading_rate=RATE)
  super(words)
  @reading_rate = reading_rate
end

Instance Attribute Details

#reading_rateObject

Returns the value of attribute reading_rate.



6
7
8
# File 'lib/rundown/processors/reading_time.rb', line 6

def reading_rate
  @reading_rate
end

Instance Method Details

#processObject



13
14
15
# File 'lib/rundown/processors/reading_time.rb', line 13

def process
  words.size * reading_rate
end