Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 2a1ced6f608b8b368f58dfd3e3d090bcb83d477c 0 parents
Gareth Rees authored
4 .gitignore
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in readingtime.gemspec
+gemspec
1  Rakefile
@@ -0,0 +1 @@
+require 'bundler/gem_tasks'
6 lib/readingtime.rb
@@ -0,0 +1,6 @@
+require "readingtime/version"
+require "readingtime/core_ext"
+
+module Readingtime
+ # Your code goes here...
+end
11 lib/readingtime/core_ext.rb
@@ -0,0 +1,11 @@
+String.class_eval do
+ def reading_time
+ word = self.scan(/(\w|-)+/).size
+
+ minutes = (word / 200).floor
+ seconds = (word % 200 / (200 / 60)).floor
+
+ return minutes.to_s + ":" + seconds.to_s
+
+ end
+end
3  lib/readingtime/version.rb
@@ -0,0 +1,3 @@
+module Readingtime
+ VERSION = "0.0.1"
+end
20 readingtime.gemspec
@@ -0,0 +1,20 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "readingtime/version"
+
+Gem::Specification.new do |s|
+ s.name = "readingtime"
+ s.version = Readingtime::VERSION
+ s.authors = ["Gareth Rees"]
+ s.email = ["reesG12@cardiff.ac.uk"]
+ s.homepage = ""
+ s.summary = %q{TODO: Write a gem summary}
+ s.description = %q{TODO: Write a gem description}
+
+ s.rubyforge_project = "readingtime"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end

0 comments on commit 2a1ced6

Please sign in to comment.
Something went wrong with that request. Please try again.