rext 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +97 -0
- data/Manifest +54 -0
- data/README.rdoc +136 -0
- data/Rakefile +16 -0
- data/benchmarks/enumerable.rb +14 -0
- data/benchmarks/proc.rb +24 -0
- data/lib/rext.rb +24 -0
- data/lib/rext/all.rb +18 -0
- data/lib/rext/array.rb +6 -0
- data/lib/rext/array/helpers.rb +64 -0
- data/lib/rext/date.rb +6 -0
- data/lib/rext/date/helpers.rb +11 -0
- data/lib/rext/enumerable.rb +6 -0
- data/lib/rext/enumerable/helpers.rb +88 -0
- data/lib/rext/hash.rb +6 -0
- data/lib/rext/hash/helpers.rb +42 -0
- data/lib/rext/integer.rb +6 -0
- data/lib/rext/integer/helpers.rb +29 -0
- data/lib/rext/module.rb +6 -0
- data/lib/rext/module/helpers.rb +85 -0
- data/lib/rext/numeric.rb +7 -0
- data/lib/rext/numeric/bytes.rb +16 -0
- data/lib/rext/numeric/time.rb +57 -0
- data/lib/rext/object.rb +7 -0
- data/lib/rext/object/helpers.rb +62 -0
- data/lib/rext/object/metaclass.rb +29 -0
- data/lib/rext/proc.rb +7 -0
- data/lib/rext/proc/helpers.rb +22 -0
- data/lib/rext/string.rb +7 -0
- data/lib/rext/string/encode.rb +82 -0
- data/lib/rext/string/helpers.rb +246 -0
- data/lib/rext/symbol.rb +6 -0
- data/lib/rext/symbol/helpers.rb +16 -0
- data/lib/rext/time.rb +6 -0
- data/lib/rext/time/helpers.rb +43 -0
- data/lib/rext/version.rb +4 -0
- data/rext.gemspec +30 -0
- data/spec/array_spec.rb +61 -0
- data/spec/date_spec.rb +14 -0
- data/spec/enumerable_spec.rb +55 -0
- data/spec/hash_spec.rb +36 -0
- data/spec/integer_spec.rb +19 -0
- data/spec/module_spec.rb +41 -0
- data/spec/numeric_spec.rb +31 -0
- data/spec/object_spec.rb +101 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/string_spec.rb +194 -0
- data/spec/symbol_spec.rb +14 -0
- data/spec/time_spec.rb +22 -0
- data/tasks/benchmark.rake +13 -0
- data/tasks/docs.rake +13 -0
- data/tasks/gemspec.rake +3 -0
- data/tasks/spec.rake +25 -0
- metadata +147 -0
data/spec/symbol_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
require 'rext/symbol'
|
4
|
+
|
5
|
+
describe Symbol do
|
6
|
+
describe "helpers" do
|
7
|
+
describe "#to_proc" do
|
8
|
+
it "should return a proc" do
|
9
|
+
:foo.to_proc.should be_a(Proc)
|
10
|
+
['foo', 'bar'].map(&:length).should == [3, 3]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/time_spec.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
require 'rext/time'
|
4
|
+
|
5
|
+
describe Time do
|
6
|
+
describe "helpers" do
|
7
|
+
describe "#in_words_since" do
|
8
|
+
it "should convert time lost to words" do
|
9
|
+
event = Time.now - 5.seconds
|
10
|
+
event.in_words_since_now.should == 'less than one minute'
|
11
|
+
event -= 1.minute
|
12
|
+
event.in_words_since_now.should == 'one minute'
|
13
|
+
event -= 2.minutes
|
14
|
+
event.in_words_since_now.should == '3 minutes'
|
15
|
+
event -= 5.years
|
16
|
+
event.in_words_since_now.should == '5 years'
|
17
|
+
event -= 100.years
|
18
|
+
event.in_words_since_now.should == 'hundreds of years'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
desc 'Run benchmark suites n TIMES, defaulting to 1000'
|
3
|
+
task :benchmark do
|
4
|
+
$times = ENV['TIMES'] || 1000
|
5
|
+
begin
|
6
|
+
require 'rext/all'
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rgauge'
|
9
|
+
rescue LoadError
|
10
|
+
abort 'visionmedia-rgauge is required, grab it from github'
|
11
|
+
end
|
12
|
+
Dir['benchmarks/*.rb'].each { |f| load f }
|
13
|
+
end
|
data/tasks/docs.rake
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
namespace :docs do
|
3
|
+
|
4
|
+
desc 'Remove rdoc products'
|
5
|
+
task :remove => [:clobber_docs]
|
6
|
+
|
7
|
+
desc 'Build docs, and open in browser for viewing (specify BROWSER)'
|
8
|
+
task :open => [:docs] do
|
9
|
+
browser = ENV["BROWSER"] || "safari"
|
10
|
+
sh "open -a #{browser} doc/index.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/tasks/gemspec.rake
ADDED
data/tasks/spec.rake
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
desc "Run all specifications"
|
5
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
6
|
+
t.libs << "lib"
|
7
|
+
t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :spec do
|
11
|
+
|
12
|
+
desc "Run all specifications verbosely"
|
13
|
+
Spec::Rake::SpecTask.new(:verbose) do |t|
|
14
|
+
t.libs << "lib"
|
15
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run specific specification verbosely (specify SPEC)"
|
19
|
+
Spec::Rake::SpecTask.new(:select) do |t|
|
20
|
+
t.libs << "lib"
|
21
|
+
t.spec_files = [ENV["SPEC"]]
|
22
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TJ Holowaychuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-08 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Ruby extensions
|
17
|
+
email: tj@vision-media.ca
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
- lib/rext.rb
|
25
|
+
- lib/rext/all.rb
|
26
|
+
- lib/rext/array.rb
|
27
|
+
- lib/rext/array/helpers.rb
|
28
|
+
- lib/rext/date.rb
|
29
|
+
- lib/rext/date/helpers.rb
|
30
|
+
- lib/rext/enumerable.rb
|
31
|
+
- lib/rext/enumerable/helpers.rb
|
32
|
+
- lib/rext/hash.rb
|
33
|
+
- lib/rext/hash/helpers.rb
|
34
|
+
- lib/rext/integer.rb
|
35
|
+
- lib/rext/integer/helpers.rb
|
36
|
+
- lib/rext/module.rb
|
37
|
+
- lib/rext/module/helpers.rb
|
38
|
+
- lib/rext/numeric.rb
|
39
|
+
- lib/rext/numeric/bytes.rb
|
40
|
+
- lib/rext/numeric/time.rb
|
41
|
+
- lib/rext/object.rb
|
42
|
+
- lib/rext/object/helpers.rb
|
43
|
+
- lib/rext/object/metaclass.rb
|
44
|
+
- lib/rext/proc.rb
|
45
|
+
- lib/rext/proc/helpers.rb
|
46
|
+
- lib/rext/string.rb
|
47
|
+
- lib/rext/string/encode.rb
|
48
|
+
- lib/rext/string/helpers.rb
|
49
|
+
- lib/rext/symbol.rb
|
50
|
+
- lib/rext/symbol/helpers.rb
|
51
|
+
- lib/rext/time.rb
|
52
|
+
- lib/rext/time/helpers.rb
|
53
|
+
- lib/rext/version.rb
|
54
|
+
- tasks/benchmark.rake
|
55
|
+
- tasks/docs.rake
|
56
|
+
- tasks/gemspec.rake
|
57
|
+
- tasks/spec.rake
|
58
|
+
files:
|
59
|
+
- History.rdoc
|
60
|
+
- Manifest
|
61
|
+
- README.rdoc
|
62
|
+
- Rakefile
|
63
|
+
- benchmarks/enumerable.rb
|
64
|
+
- benchmarks/proc.rb
|
65
|
+
- lib/rext.rb
|
66
|
+
- lib/rext/all.rb
|
67
|
+
- lib/rext/array.rb
|
68
|
+
- lib/rext/array/helpers.rb
|
69
|
+
- lib/rext/date.rb
|
70
|
+
- lib/rext/date/helpers.rb
|
71
|
+
- lib/rext/enumerable.rb
|
72
|
+
- lib/rext/enumerable/helpers.rb
|
73
|
+
- lib/rext/hash.rb
|
74
|
+
- lib/rext/hash/helpers.rb
|
75
|
+
- lib/rext/integer.rb
|
76
|
+
- lib/rext/integer/helpers.rb
|
77
|
+
- lib/rext/module.rb
|
78
|
+
- lib/rext/module/helpers.rb
|
79
|
+
- lib/rext/numeric.rb
|
80
|
+
- lib/rext/numeric/bytes.rb
|
81
|
+
- lib/rext/numeric/time.rb
|
82
|
+
- lib/rext/object.rb
|
83
|
+
- lib/rext/object/helpers.rb
|
84
|
+
- lib/rext/object/metaclass.rb
|
85
|
+
- lib/rext/proc.rb
|
86
|
+
- lib/rext/proc/helpers.rb
|
87
|
+
- lib/rext/string.rb
|
88
|
+
- lib/rext/string/encode.rb
|
89
|
+
- lib/rext/string/helpers.rb
|
90
|
+
- lib/rext/symbol.rb
|
91
|
+
- lib/rext/symbol/helpers.rb
|
92
|
+
- lib/rext/time.rb
|
93
|
+
- lib/rext/time/helpers.rb
|
94
|
+
- lib/rext/version.rb
|
95
|
+
- rext.gemspec
|
96
|
+
- spec/array_spec.rb
|
97
|
+
- spec/date_spec.rb
|
98
|
+
- spec/enumerable_spec.rb
|
99
|
+
- spec/hash_spec.rb
|
100
|
+
- spec/integer_spec.rb
|
101
|
+
- spec/module_spec.rb
|
102
|
+
- spec/numeric_spec.rb
|
103
|
+
- spec/object_spec.rb
|
104
|
+
- spec/spec.opts
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
- spec/string_spec.rb
|
107
|
+
- spec/symbol_spec.rb
|
108
|
+
- spec/time_spec.rb
|
109
|
+
- tasks/benchmark.rake
|
110
|
+
- tasks/docs.rake
|
111
|
+
- tasks/gemspec.rake
|
112
|
+
- tasks/spec.rake
|
113
|
+
has_rdoc: true
|
114
|
+
homepage: http://github.com/visionmedia/rext
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options:
|
119
|
+
- --line-numbers
|
120
|
+
- --inline-source
|
121
|
+
- --title
|
122
|
+
- Rext
|
123
|
+
- --main
|
124
|
+
- README.rdoc
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: "0"
|
132
|
+
version:
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: "1.2"
|
138
|
+
version:
|
139
|
+
requirements: []
|
140
|
+
|
141
|
+
rubyforge_project: rext
|
142
|
+
rubygems_version: 1.3.5
|
143
|
+
signing_key:
|
144
|
+
specification_version: 3
|
145
|
+
summary: Ruby extensions
|
146
|
+
test_files: []
|
147
|
+
|