Module: Readingtime

Defined in:
lib/readingtime.rb,
lib/readingtime/version.rb,
lib/readingtime/calculator.rb,
lib/readingtime/configuration.rb

Defined Under Namespace

Classes: Calculator, Configuration

Constant Summary collapse

VERSION =
"0.4.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



8
9
10
# File 'lib/readingtime.rb', line 8

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



11
12
13
# File 'lib/readingtime.rb', line 11

def self.configure
  yield(configuration)
end

.format_approx(seconds) ⇒ Object



49
50
51
52
# File 'lib/readingtime.rb', line 49

def self.format_approx(seconds)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.format_approx(seconds)
end

.format_full(hms) ⇒ Object



54
55
56
57
# File 'lib/readingtime.rb', line 54

def self.format_full(hms)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.format_full(hms)
end

.format_seconds(seconds) ⇒ Object

TODO: Account for HH:MM:00



39
40
41
42
# File 'lib/readingtime.rb', line 39

def self.format_seconds(seconds)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.format_seconds(seconds)
end

.format_words(seconds) ⇒ Object



44
45
46
47
# File 'lib/readingtime.rb', line 44

def self.format_words(seconds)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.format_words(seconds)
end

.hms(secs) ⇒ Object



23
24
25
26
# File 'lib/readingtime.rb', line 23

def self.hms(secs)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.hms(secs)
end

.minutes_in_seconds(words) ⇒ Object



28
29
30
31
# File 'lib/readingtime.rb', line 28

def self.minutes_in_seconds(words)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.minutes_in_seconds(words)
end

.reading_speedObject



19
20
21
# File 'lib/readingtime.rb', line 19

def self.reading_speed
  configuration.reading_speed
end

.seconds(words) ⇒ Object



33
34
35
36
# File 'lib/readingtime.rb', line 33

def self.seconds(words)
  calculator = Calculator.new(:reading_speed => self.reading_speed)
  calculator.seconds(words)
end