readingtime 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01c44cb3bfde84a62cb226ff37d727a9842cc28f
4
- data.tar.gz: ed919fb05b30d745a486d0f7a685248b038c1a2f
3
+ metadata.gz: 051306bfbc8ee1305b2083c96297de0f31817ca6
4
+ data.tar.gz: 3bf8f9d8b5663053ec6a182f3b3b58260c7e4c76
5
5
  SHA512:
6
- metadata.gz: 1a77483f0233efda41152c352cb7979399d3c9f97a2c6d7a93dac307e092750dde8055a70a1509eaefc129b2ce2be769edcd3256b8a079fbc7ceb448a8e1cbf1
7
- data.tar.gz: 12a9e3694359349b3b7247adff6e3c04605279907973ac3898ee8cff3dc9ebe40e73666be6b78291a4c700000c40a085e346cb1d3d347de2e4cb44f9065694b3
6
+ metadata.gz: f87f58774cf708e2fef15882eaa18469efad6d9ba5fc69bd761d086525f843c57b0ed8424b521f1c119822e1b49520f49c3b14d9fb2ec6ba4b34adaa83f053c9
7
+ data.tar.gz: 122e03abc0d2423a6400b042056c37b76714ebcc038943394cdf3afc961ef7d1ff0958339c9f8add1eb54c66f4e8f502685033f5863d338df83ce55533dd9e6d
data/LICENCE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Gareth Rees
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/lib/readingtime.rb CHANGED
@@ -27,7 +27,12 @@ module Readingtime
27
27
  end
28
28
 
29
29
  def self.format_words(seconds)
30
- '%d minutes and %d seconds' % seconds.divmod(60)
30
+ if seconds >= 60
31
+ '%d minutes and %d seconds' % seconds.divmod(60)
32
+ else
33
+ "#{ seconds } seconds"
34
+ end
35
+
31
36
  end
32
37
 
33
38
  def self.format_approx(seconds)
@@ -1,3 +1,3 @@
1
1
  module Readingtime
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -52,6 +52,7 @@ describe Readingtime do
52
52
  end
53
53
 
54
54
  it "should accept an options hash to format the output" do
55
+ ten_words.reading_time(:format => :long).should == "3 seconds"
55
56
  two_hundred_words.reading_time(:format => :basic).should == "01:00"
56
57
  two_hundred_words.reading_time(:format => :long).should == "1 minutes and 0 seconds"
57
58
  two_hundred_words.reading_time(:format => :approx).should == "1 minutes"
@@ -65,4 +66,4 @@ describe Readingtime do
65
66
  two_hundred_words.reading_time(:format => :raw).should == [0, 1, 0]
66
67
  end
67
68
 
68
- end
69
+ end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readingtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth Rees
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-22 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.6'
41
41
  description: Estimates reading time of a Ruby String object
@@ -45,9 +45,10 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
49
- - ".travis.yml"
48
+ - .gitignore
49
+ - .travis.yml
50
50
  - Gemfile
51
+ - LICENCE.md
51
52
  - README.md
52
53
  - Rakefile
53
54
  - lib/readingtime.rb
@@ -64,17 +65,17 @@ require_paths:
64
65
  - lib
65
66
  required_ruby_version: !ruby/object:Gem::Requirement
66
67
  requirements:
67
- - - ">="
68
+ - - '>='
68
69
  - !ruby/object:Gem::Version
69
70
  version: '0'
70
71
  required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  requirements:
72
- - - ">="
73
+ - - '>='
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0'
75
76
  requirements: []
76
77
  rubyforge_project: readingtime
77
- rubygems_version: 2.2.0
78
+ rubygems_version: 2.0.14
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: Estimates reading time