darkext 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/History.txt +140 -0
- data/LICENSE +21 -0
- data/README.md +45 -0
- data/Rakefile +45 -0
- data/TODO +4 -0
- data/VERSION.yml +4 -0
- data/app_generators/sinatra_app_generator.rb +57 -0
- data/app_generators/templates/app.rb +16 -0
- data/app_generators/templates/config.ru +2 -0
- data/app_generators/templates/error.rb +8 -0
- data/app_generators/templates/gitignore +0 -0
- data/app_generators/templates/helpers.rb +12 -0
- data/app_generators/templates/http_method.rb +8 -0
- data/app_generators/templates/options.rb +9 -0
- data/bin/sinatra-app +14 -0
- data/darkext.gemspec +105 -0
- data/lib/darkext.rb +13 -0
- data/lib/darkext/array.rb +52 -0
- data/lib/darkext/beagle.rb +88 -0
- data/lib/darkext/boolean.rb +17 -0
- data/lib/darkext/fiber.rb +48 -0
- data/lib/darkext/float.rb +6 -0
- data/lib/darkext/hash.rb +38 -0
- data/lib/darkext/integer.rb +10 -0
- data/lib/darkext/io.rb +37 -0
- data/lib/darkext/net.rb +28 -0
- data/lib/darkext/numeric.rb +35 -0
- data/lib/darkext/object.rb +11 -0
- data/lib/darkext/sinatra.rb +70 -0
- data/lib/darkext/sitemap_generator.rb +90 -0
- data/lib/darkext/statistics.rb +197 -0
- data/lib/darkext/string.rb +63 -0
- data/lib/darkext/symbol.rb +7 -0
- data/spec/array_spec.rb +112 -0
- data/spec/beagle_spec.rb +42 -0
- data/spec/boolean_spec.rb +53 -0
- data/spec/fiber_spec.rb +35 -0
- data/spec/float_spec.rb +18 -0
- data/spec/hash_spec.rb +26 -0
- data/spec/integer_spec.rb +22 -0
- data/spec/io_spec.rb +44 -0
- data/spec/net_spec.rb +23 -0
- data/spec/numeric_spec.rb +52 -0
- data/spec/object_spec.rb +28 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/statistics_spec.rb +162 -0
- data/spec/string_spec.rb +54 -0
- data/spec/symbol_spec.rb +16 -0
- metadata +119 -0
data/spec/string_spec.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
it 'should respond to the new methods' do
|
5
|
+
'foo'.should respond_to(*%w(to_range exec print printn true? false? starts_with? ends_with? /))
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return a boolean from starts_with? and ends_with?' do
|
9
|
+
'foo'.starts_with?('fo').is_boolean?.should be_true
|
10
|
+
'foo'.ends_with?('oo').is_boolean?.should be_true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return a boolean from true? and false?' do
|
14
|
+
'true'.true?.is_boolean?.should be_true
|
15
|
+
'false'.false?.is_boolean?.should be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return the same thing from / as split' do
|
19
|
+
'f.o.o'.split('.').should eql('f.o.o' / '.')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return a range from to_range if it works' do
|
23
|
+
'1..5'.to_range.should be_a_kind_of(Range)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should return nil if the range is not a valid format' do
|
27
|
+
lambda { 'nipples'.to_range }.should raise_error
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should convert to range' do
|
31
|
+
'1..10'.to_range.should == (1..10)
|
32
|
+
'1...10'.to_range.should == (1...10)
|
33
|
+
'a..z'.to_range.should == ('a'..'z')
|
34
|
+
'a...z'.to_range.should == ('a'...'z')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should be true' do
|
38
|
+
%w(true TRUE True).each { |t| t.true?.should be_true }
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should be false' do
|
42
|
+
%w(false FALSE False).each { |f| f.false?.should be_true }
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should start with' do
|
46
|
+
'foobar'.starts_with?('foo').should be_true
|
47
|
+
'foobar'.starts_with?('bar').should be_false
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should end with' do
|
51
|
+
'foobar'.ends_with?('bar').should be_true
|
52
|
+
'foobar'.ends_with?('foo').should be_false
|
53
|
+
end
|
54
|
+
end
|
data/spec/symbol_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe Symbol do
|
4
|
+
it 'should respond to the new methods' do
|
5
|
+
Proc.new{ }.should respond_to(*%w(to_proc))
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return a Proc from to_proc' do
|
9
|
+
:foo.to_proc.should be_a_kind_of(Proc)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should properly to do to_proc' do
|
13
|
+
'abc'.map(&:upcase).first.should == 'ABC'
|
14
|
+
[1,2,3,4].map(&:square).should == [1,4,9,16]
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: darkext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.12.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Huckstep
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-11 00:00:00 -06:00
|
13
|
+
default_executable: sinatra-app
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Just some useful Ruby functionality. No particular focus, except usefulness
|
17
|
+
email: darkhelmet@darkhelmetlive.com
|
18
|
+
executables:
|
19
|
+
- sinatra-app
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- History.txt
|
28
|
+
- LICENSE
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- TODO
|
32
|
+
- VERSION.yml
|
33
|
+
- app_generators/sinatra_app_generator.rb
|
34
|
+
- app_generators/templates/app.rb
|
35
|
+
- app_generators/templates/config.ru
|
36
|
+
- app_generators/templates/error.rb
|
37
|
+
- app_generators/templates/gitignore
|
38
|
+
- app_generators/templates/helpers.rb
|
39
|
+
- app_generators/templates/http_method.rb
|
40
|
+
- app_generators/templates/options.rb
|
41
|
+
- bin/sinatra-app
|
42
|
+
- darkext.gemspec
|
43
|
+
- lib/darkext.rb
|
44
|
+
- lib/darkext/array.rb
|
45
|
+
- lib/darkext/beagle.rb
|
46
|
+
- lib/darkext/boolean.rb
|
47
|
+
- lib/darkext/fiber.rb
|
48
|
+
- lib/darkext/float.rb
|
49
|
+
- lib/darkext/hash.rb
|
50
|
+
- lib/darkext/integer.rb
|
51
|
+
- lib/darkext/io.rb
|
52
|
+
- lib/darkext/net.rb
|
53
|
+
- lib/darkext/numeric.rb
|
54
|
+
- lib/darkext/object.rb
|
55
|
+
- lib/darkext/sinatra.rb
|
56
|
+
- lib/darkext/sitemap_generator.rb
|
57
|
+
- lib/darkext/statistics.rb
|
58
|
+
- lib/darkext/string.rb
|
59
|
+
- lib/darkext/symbol.rb
|
60
|
+
- spec/array_spec.rb
|
61
|
+
- spec/beagle_spec.rb
|
62
|
+
- spec/boolean_spec.rb
|
63
|
+
- spec/fiber_spec.rb
|
64
|
+
- spec/float_spec.rb
|
65
|
+
- spec/hash_spec.rb
|
66
|
+
- spec/integer_spec.rb
|
67
|
+
- spec/io_spec.rb
|
68
|
+
- spec/net_spec.rb
|
69
|
+
- spec/numeric_spec.rb
|
70
|
+
- spec/object_spec.rb
|
71
|
+
- spec/spec.opts
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
- spec/statistics_spec.rb
|
74
|
+
- spec/string_spec.rb
|
75
|
+
- spec/symbol_spec.rb
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/darkhelmet/darkext
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
version:
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
version:
|
97
|
+
requirements: []
|
98
|
+
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 1.3.5
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Just some useful Ruby functionality
|
104
|
+
test_files:
|
105
|
+
- spec/array_spec.rb
|
106
|
+
- spec/beagle_spec.rb
|
107
|
+
- spec/boolean_spec.rb
|
108
|
+
- spec/fiber_spec.rb
|
109
|
+
- spec/float_spec.rb
|
110
|
+
- spec/hash_spec.rb
|
111
|
+
- spec/integer_spec.rb
|
112
|
+
- spec/io_spec.rb
|
113
|
+
- spec/net_spec.rb
|
114
|
+
- spec/numeric_spec.rb
|
115
|
+
- spec/object_spec.rb
|
116
|
+
- spec/statistics_spec.rb
|
117
|
+
- spec/string_spec.rb
|
118
|
+
- spec/symbol_spec.rb
|
119
|
+
- spec/spec_helper.rb
|