sleepsort 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 sleepsort.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/lib/sleepsort.rb ADDED
@@ -0,0 +1,14 @@
1
+ module Sleepsort
2
+ def self.sort(array)
3
+ []
4
+ .tap { |a| array.map { |e| Thread.new{ sleep e.to_f/1000; a << e} }
5
+ .each{|t| t.join} }
6
+ end
7
+ end
8
+
9
+ class Array
10
+ def sleep_sort
11
+ Sleepsort.sort(self)
12
+ end
13
+ end
14
+
@@ -0,0 +1,3 @@
1
+ module Sleepsort
2
+ VERSION = "0.0.1"
3
+ end
data/sleepsort.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "sleepsort/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sleepsort"
7
+ s.version = Sleepsort::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Piotr Paweł Dębosz"]
10
+ s.email = ["piotr.debosz@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Sleep sort is the best performance sorting algorithm for arrays}
13
+ s.description = %q{Sleep sort is the best performance sorting algorithm for arrays}
14
+
15
+ s.rubyforge_project = "sleepsort"
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
22
+
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sleepsort
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - "Piotr Pawe\xC5\x82 D\xC4\x99bosz"
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-20 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Sleep sort is the best performance sorting algorithm for arrays
18
+ email:
19
+ - piotr.debosz@gmail.com
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - Rakefile
30
+ - lib/sleepsort.rb
31
+ - lib/sleepsort/version.rb
32
+ - sleepsort.gemspec
33
+ has_rdoc: true
34
+ homepage: ""
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: sleepsort
57
+ rubygems_version: 1.6.2
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Sleep sort is the best performance sorting algorithm for arrays
61
+ test_files: []
62
+