playtime 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in playtime.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module Playtime
2
+ VERSION = "0.0.1"
3
+ end
data/lib/playtime.rb ADDED
@@ -0,0 +1,37 @@
1
+ class Integer
2
+
3
+ def to_playtime
4
+ Playtime.new(self)
5
+ end
6
+
7
+ end
8
+
9
+
10
+ module Playtime
11
+
12
+ def initialize(seconds)
13
+ raise "imported"
14
+ @time = seconds
15
+ end
16
+
17
+ def to_s
18
+ hours > 0 ? "#{hours}:#{"%02d" % minutes}:#{"%02d" % seconds}" : "#{"%02d" % minutes}:#{"%02d" % seconds}"
19
+ end
20
+
21
+ def seconds
22
+ (@time % 60)
23
+ end
24
+
25
+ def minutes
26
+ if hours > 0
27
+ (@time / 60) - (hours * 60)
28
+ else
29
+ @time / 60
30
+ end
31
+ end
32
+
33
+ def hours
34
+ @time / 3600
35
+ end
36
+
37
+ end
data/playtime.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "playtime/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "playtime"
7
+ s.version = Playtime::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Brandon Hansen"]
10
+ s.email = ["brandon@morethanaprogrammer"]
11
+ s.homepage = "http://morethanaprogrammer.com"
12
+ s.summary = %q{Converts seconds to a playtime HH:MM:SS or MM:SS}
13
+ s.description = %q{Converts seconds to a playtime HH:MM:SS or MM:SS}
14
+
15
+ s.rubyforge_project = "playtime"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: playtime
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Brandon Hansen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-17 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Converts seconds to a playtime HH:MM:SS or MM:SS
18
+ email:
19
+ - brandon@morethanaprogrammer
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - Rakefile
30
+ - lib/playtime.rb
31
+ - lib/playtime/version.rb
32
+ - playtime.gemspec
33
+ has_rdoc: true
34
+ homepage: http://morethanaprogrammer.com
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project: playtime
57
+ rubygems_version: 1.6.2
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Converts seconds to a playtime HH:MM:SS or MM:SS
61
+ test_files: []
62
+