gorillib 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/.gitignore +49 -0
  2. data/.rspec +2 -0
  3. data/CHANGELOG.textile +49 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +36 -0
  6. data/README.textile +6 -1
  7. data/Rakefile +42 -9
  8. data/VERSION +1 -1
  9. data/gorillib.gemspec +110 -73
  10. data/lib/gorillib/array/deep_compact.rb +3 -12
  11. data/lib/gorillib/datetime/#flat.rb# +30 -0
  12. data/lib/gorillib/datetime/flat.rb +2 -10
  13. data/lib/gorillib/datetime/parse.rb +3 -1
  14. data/lib/gorillib/enumerable/sum.rb +37 -35
  15. data/lib/gorillib/hash/deep_compact.rb +3 -13
  16. data/lib/gorillib/logger/log.rb +1 -1
  17. data/lib/gorillib/numeric/clamp.rb +9 -0
  18. data/lib/gorillib/object/try.rb +10 -0
  19. data/lib/gorillib/object/try_dup.rb +44 -0
  20. data/lib/gorillib/string/human.rb +1 -3
  21. data/lib/gorillib/string/truncate.rb +2 -2
  22. data/spec/array/compact_blank_spec.rb +37 -0
  23. data/spec/array/extract_options_spec.rb +47 -0
  24. data/spec/datetime/flat_spec.rb +38 -0
  25. data/spec/datetime/parse_spec.rb +48 -0
  26. data/spec/enumerable/sum_spec.rb +56 -0
  27. data/spec/hash/compact_spec.rb +70 -0
  28. data/spec/hash/deep_compact_spec.rb +37 -0
  29. data/spec/hash/deep_merge_spec.rb +117 -0
  30. data/spec/hash/keys_spec.rb +111 -0
  31. data/spec/hash/reverse_merge_spec.rb +25 -0
  32. data/spec/hash/slice_spec.rb +43 -0
  33. data/spec/hash/zip_spec.rb +31 -0
  34. data/spec/logger/log_spec.rb +31 -0
  35. data/spec/metaprogramming/aliasing_spec.rb +177 -0
  36. data/spec/metaprogramming/cattr_accessor_spec.rb +41 -0
  37. data/spec/metaprogramming/class_attribute_spec.rb +75 -0
  38. data/spec/metaprogramming/delegation_spec.rb +166 -0
  39. data/spec/metaprogramming/mattr_accessor_spec.rb +44 -0
  40. data/spec/metaprogramming/singleton_class_spec.rb +9 -0
  41. data/spec/{numeric_spec.rb → numeric/clamp_spec.rb} +2 -2
  42. data/spec/object/blank_spec.rb +93 -0
  43. data/spec/object/try_dup_spec.rb +47 -0
  44. data/spec/object/try_spec.rb +20 -0
  45. data/spec/spec_helper.rb +13 -8
  46. data/spec/string/constantize_spec.rb +56 -0
  47. data/spec/string/human_spec.rb +66 -0
  48. data/spec/string/inflections_spec.rb +74 -0
  49. data/{test → spec}/string/inflector_test_cases.rb +0 -0
  50. data/spec/string/truncate_spec.rb +42 -0
  51. data/spec/support/kcode_test_helper.rb +16 -0
  52. metadata +209 -96
  53. data/.document +0 -5
  54. data/fiddle/hubahuba.rb +0 -62
  55. data/spec/blank_spec.rb +0 -86
  56. data/spec/deep_compact_spec.rb +0 -36
  57. data/spec/gorillib_spec.rb +0 -7
  58. data/spec/rcov.opts +0 -6
  59. data/spec/spec.opts +0 -4
  60. data/spec/spec_tasks.rake +0 -15
  61. data/test/abstract_unit.rb +0 -25
  62. data/test/array/compact_blank_test.rb +0 -33
  63. data/test/array/extract_options_test.rb +0 -39
  64. data/test/datetime/flat_test.rb +0 -0
  65. data/test/datetime/parse_test.rb +0 -0
  66. data/test/enumerable/sum_test.rb +0 -50
  67. data/test/hash/compact_test.rb +0 -38
  68. data/test/hash/deep_merge_test.rb +0 -30
  69. data/test/hash/keys_test.rb +0 -110
  70. data/test/hash/reverse_merge_test.rb +0 -20
  71. data/test/hash/slice_test.rb +0 -47
  72. data/test/hash/zip_test.rb +0 -0
  73. data/test/logger/log_test.rb +0 -0
  74. data/test/metaprogramming/aliasing_test.rb +0 -188
  75. data/test/metaprogramming/cattr_accessor_test.rb +0 -38
  76. data/test/metaprogramming/class_attribute_test.rb +0 -73
  77. data/test/metaprogramming/delegation_test.rb +0 -166
  78. data/test/metaprogramming/mattr_accessor_test.rb +0 -40
  79. data/test/metaprogramming/singleton_class_test.rb +0 -9
  80. data/test/object/blank_test.rb +0 -22
  81. data/test/string/constantize_test.rb +0 -30
  82. data/test/string/human_test.rb +0 -65
  83. data/test/string/inflections_test.rb +0 -57
  84. data/test/string/truncate_test.rb +0 -37
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorillib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 7
10
- version: 0.0.7
4
+ prerelease:
5
+ version: 0.0.8
11
6
  platform: ruby
12
7
  authors:
13
8
  - Infochimps
@@ -15,55 +10,174 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-05-05 00:00:00 -05:00
13
+ date: 2011-05-20 00:00:00 -05:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
22
- name: yard
23
- prerelease: false
17
+ name: bundler
24
18
  requirement: &id001 !ruby/object:Gem::Requirement
25
19
  none: false
26
20
  requirements:
27
21
  - - ~>
28
22
  - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 0
32
- - 6
33
- - 0
34
- version: 0.6.0
23
+ version: 1.0.12
35
24
  type: :development
25
+ prerelease: false
36
26
  version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.6.7
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *id002
37
38
  - !ruby/object:Gem::Dependency
38
39
  name: jeweler
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.2
46
+ type: :development
39
47
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 2.5.0
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: spork
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.9.0.rc5
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: RedCloth
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: rcov
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.9
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: watchr
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ type: :development
102
+ prerelease: false
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
+ name: bundler
106
+ requirement: &id009 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: 1.0.12
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: *id009
115
+ - !ruby/object:Gem::Dependency
116
+ name: yard
117
+ requirement: &id010 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ~>
121
+ - !ruby/object:Gem::Version
122
+ version: 0.6.7
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: *id010
126
+ - !ruby/object:Gem::Dependency
127
+ name: jeweler
128
+ requirement: &id011 !ruby/object:Gem::Requirement
41
129
  none: false
42
130
  requirements:
43
131
  - - ~>
44
132
  - !ruby/object:Gem::Version
45
- hash: 7
46
- segments:
47
- - 1
48
- - 5
49
- - 2
50
133
  version: 1.5.2
51
134
  type: :development
52
- version_requirements: *id002
135
+ prerelease: false
136
+ version_requirements: *id011
137
+ - !ruby/object:Gem::Dependency
138
+ name: rspec
139
+ requirement: &id012 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ version: 2.5.0
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: *id012
53
148
  - !ruby/object:Gem::Dependency
54
149
  name: rcov
150
+ requirement: &id013 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 0.9.9
156
+ type: :development
55
157
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
158
+ version_requirements: *id013
159
+ - !ruby/object:Gem::Dependency
160
+ name: spork
161
+ requirement: &id014 !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: 0.9.0.rc5
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: *id014
170
+ - !ruby/object:Gem::Dependency
171
+ name: watchr
172
+ requirement: &id015 !ruby/object:Gem::Requirement
57
173
  none: false
58
174
  requirements:
59
175
  - - ">="
60
176
  - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
177
  version: "0"
65
178
  type: :development
66
- version_requirements: *id003
179
+ prerelease: false
180
+ version_requirements: *id015
67
181
  description: "Gorillib: infochimps lightweight subset of ruby convenience methods"
68
182
  email: coders@infochimps.org
69
183
  executables: []
@@ -74,19 +188,22 @@ extra_rdoc_files:
74
188
  - LICENSE.textile
75
189
  - README.textile
76
190
  files:
77
- - .document
191
+ - .gitignore
78
192
  - .rspec
193
+ - CHANGELOG.textile
194
+ - Gemfile
195
+ - Gemfile.lock
79
196
  - LICENSE.textile
80
197
  - README.textile
81
198
  - Rakefile
82
199
  - VERSION
83
- - fiddle/hubahuba.rb
84
200
  - gorillib.gemspec
85
201
  - lib/gorillib.rb
86
202
  - lib/gorillib/array/compact_blank.rb
87
203
  - lib/gorillib/array/deep_compact.rb
88
204
  - lib/gorillib/array/extract_options.rb
89
205
  - lib/gorillib/base.rb
206
+ - lib/gorillib/datetime/#flat.rb#
90
207
  - lib/gorillib/datetime/flat.rb
91
208
  - lib/gorillib/datetime/parse.rb
92
209
  - lib/gorillib/enumerable/sum.rb
@@ -107,44 +224,43 @@ files:
107
224
  - lib/gorillib/metaprogramming/singleton_class.rb
108
225
  - lib/gorillib/numeric/clamp.rb
109
226
  - lib/gorillib/object/blank.rb
227
+ - lib/gorillib/object/try.rb
228
+ - lib/gorillib/object/try_dup.rb
110
229
  - lib/gorillib/some.rb
111
230
  - lib/gorillib/string/constantize.rb
112
231
  - lib/gorillib/string/human.rb
113
232
  - lib/gorillib/string/inflections.rb
114
233
  - lib/gorillib/string/truncate.rb
115
- - spec/blank_spec.rb
116
- - spec/deep_compact_spec.rb
117
- - spec/gorillib_spec.rb
118
- - spec/numeric_spec.rb
119
- - spec/rcov.opts
120
- - spec/spec.opts
234
+ - spec/array/compact_blank_spec.rb
235
+ - spec/array/extract_options_spec.rb
236
+ - spec/datetime/flat_spec.rb
237
+ - spec/datetime/parse_spec.rb
238
+ - spec/enumerable/sum_spec.rb
239
+ - spec/hash/compact_spec.rb
240
+ - spec/hash/deep_compact_spec.rb
241
+ - spec/hash/deep_merge_spec.rb
242
+ - spec/hash/keys_spec.rb
243
+ - spec/hash/reverse_merge_spec.rb
244
+ - spec/hash/slice_spec.rb
245
+ - spec/hash/zip_spec.rb
246
+ - spec/logger/log_spec.rb
247
+ - spec/metaprogramming/aliasing_spec.rb
248
+ - spec/metaprogramming/cattr_accessor_spec.rb
249
+ - spec/metaprogramming/class_attribute_spec.rb
250
+ - spec/metaprogramming/delegation_spec.rb
251
+ - spec/metaprogramming/mattr_accessor_spec.rb
252
+ - spec/metaprogramming/singleton_class_spec.rb
253
+ - spec/numeric/clamp_spec.rb
254
+ - spec/object/blank_spec.rb
255
+ - spec/object/try_dup_spec.rb
256
+ - spec/object/try_spec.rb
121
257
  - spec/spec_helper.rb
122
- - spec/spec_tasks.rake
123
- - test/abstract_unit.rb
124
- - test/array/compact_blank_test.rb
125
- - test/array/extract_options_test.rb
126
- - test/datetime/flat_test.rb
127
- - test/datetime/parse_test.rb
128
- - test/enumerable/sum_test.rb
129
- - test/hash/compact_test.rb
130
- - test/hash/deep_merge_test.rb
131
- - test/hash/keys_test.rb
132
- - test/hash/reverse_merge_test.rb
133
- - test/hash/slice_test.rb
134
- - test/hash/zip_test.rb
135
- - test/logger/log_test.rb
136
- - test/metaprogramming/aliasing_test.rb
137
- - test/metaprogramming/cattr_accessor_test.rb
138
- - test/metaprogramming/class_attribute_test.rb
139
- - test/metaprogramming/delegation_test.rb
140
- - test/metaprogramming/mattr_accessor_test.rb
141
- - test/metaprogramming/singleton_class_test.rb
142
- - test/object/blank_test.rb
143
- - test/string/constantize_test.rb
144
- - test/string/human_test.rb
145
- - test/string/inflections_test.rb
146
- - test/string/inflector_test_cases.rb
147
- - test/string/truncate_test.rb
258
+ - spec/string/constantize_spec.rb
259
+ - spec/string/human_spec.rb
260
+ - spec/string/inflections_spec.rb
261
+ - spec/string/inflector_test_cases.rb
262
+ - spec/string/truncate_spec.rb
263
+ - spec/support/kcode_test_helper.rb
148
264
  has_rdoc: true
149
265
  homepage: http://infochimps.com/labs
150
266
  licenses:
@@ -159,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
275
  requirements:
160
276
  - - ">="
161
277
  - !ruby/object:Gem::Version
162
- hash: 3
278
+ hash: 991802759410469185
163
279
  segments:
164
280
  - 0
165
281
  version: "0"
@@ -168,45 +284,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
284
  requirements:
169
285
  - - ">="
170
286
  - !ruby/object:Gem::Version
171
- hash: 3
172
- segments:
173
- - 0
174
287
  version: "0"
175
288
  requirements: []
176
289
 
177
290
  rubyforge_project:
178
- rubygems_version: 1.3.7
291
+ rubygems_version: 1.5.0
179
292
  signing_key:
180
293
  specification_version: 3
181
294
  summary: include only what you need. No dependencies, no creep
182
295
  test_files:
183
- - spec/blank_spec.rb
184
- - spec/deep_compact_spec.rb
185
- - spec/gorillib_spec.rb
186
- - spec/numeric_spec.rb
296
+ - spec/array/compact_blank_spec.rb
297
+ - spec/array/extract_options_spec.rb
298
+ - spec/datetime/flat_spec.rb
299
+ - spec/datetime/parse_spec.rb
300
+ - spec/enumerable/sum_spec.rb
301
+ - spec/hash/compact_spec.rb
302
+ - spec/hash/deep_compact_spec.rb
303
+ - spec/hash/deep_merge_spec.rb
304
+ - spec/hash/keys_spec.rb
305
+ - spec/hash/reverse_merge_spec.rb
306
+ - spec/hash/slice_spec.rb
307
+ - spec/hash/zip_spec.rb
308
+ - spec/logger/log_spec.rb
309
+ - spec/metaprogramming/aliasing_spec.rb
310
+ - spec/metaprogramming/cattr_accessor_spec.rb
311
+ - spec/metaprogramming/class_attribute_spec.rb
312
+ - spec/metaprogramming/delegation_spec.rb
313
+ - spec/metaprogramming/mattr_accessor_spec.rb
314
+ - spec/metaprogramming/singleton_class_spec.rb
315
+ - spec/numeric/clamp_spec.rb
316
+ - spec/object/blank_spec.rb
317
+ - spec/object/try_dup_spec.rb
318
+ - spec/object/try_spec.rb
187
319
  - spec/spec_helper.rb
188
- - test/abstract_unit.rb
189
- - test/array/compact_blank_test.rb
190
- - test/array/extract_options_test.rb
191
- - test/datetime/flat_test.rb
192
- - test/datetime/parse_test.rb
193
- - test/enumerable/sum_test.rb
194
- - test/hash/compact_test.rb
195
- - test/hash/deep_merge_test.rb
196
- - test/hash/keys_test.rb
197
- - test/hash/reverse_merge_test.rb
198
- - test/hash/slice_test.rb
199
- - test/hash/zip_test.rb
200
- - test/logger/log_test.rb
201
- - test/metaprogramming/aliasing_test.rb
202
- - test/metaprogramming/cattr_accessor_test.rb
203
- - test/metaprogramming/class_attribute_test.rb
204
- - test/metaprogramming/delegation_test.rb
205
- - test/metaprogramming/mattr_accessor_test.rb
206
- - test/metaprogramming/singleton_class_test.rb
207
- - test/object/blank_test.rb
208
- - test/string/constantize_test.rb
209
- - test/string/human_test.rb
210
- - test/string/inflections_test.rb
211
- - test/string/inflector_test_cases.rb
212
- - test/string/truncate_test.rb
320
+ - spec/string/constantize_spec.rb
321
+ - spec/string/human_spec.rb
322
+ - spec/string/inflections_spec.rb
323
+ - spec/string/inflector_test_cases.rb
324
+ - spec/string/truncate_spec.rb
325
+ - spec/support/kcode_test_helper.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/fiddle/hubahuba.rb DELETED
@@ -1,62 +0,0 @@
1
-
2
- module Enumerable
3
- def map_with_index
4
- result = []
5
- self.each_with_index do |elt, idx|
6
- result << yield(elt, idx)
7
- end
8
- result
9
- end
10
- end
11
-
12
- https://github.com/github/hubahuba/tree/master/lib
13
-
14
-
15
- class Object
16
- # Metaid == a few simple metaclass helper
17
- # (See http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html.)
18
- # The hidden singleton lurks behind everyone
19
- def metaclass() class << self; self end end
20
- def meta_eval(&blk) metaclass.instance_eval(&blk) end
21
-
22
- # Adds methods to a metaclass
23
- def meta_def(name, &blk)
24
- meta_eval { define_method(name, &blk) }
25
- end
26
-
27
- # Defines an instance method within a class
28
- def class_def(name, &blk)
29
- class_eval { define_method(name, &blk) }
30
- end
31
-
32
- ##
33
- # if ''.not.blank?
34
- # http://blog.jayfields.com/2007/08/ruby-adding-not-method-for-readability.html
35
- define_method :not do
36
- Not.new(self)
37
- end
38
-
39
- class Not
40
- private *instance_methods.select { |m| m !~ /(^__|^\W|^binding$)/ }
41
-
42
- def initialize(subject)
43
- @subject = subject
44
- end
45
-
46
- def method_missing(sym, *args, &blk)
47
- !@subject.send(sym,*args,&blk)
48
- end
49
- end
50
-
51
- ##
52
- # @person ? @person.name : nil
53
- # vs
54
- # @person.try(:name)
55
- def try(method)
56
- send method if respond_to? method
57
- end
58
-
59
- def class_attr_accessor(*attrs)
60
- metaclass.send(:attr_accessor, *attrs)
61
- end
62
- end
data/spec/blank_spec.rb DELETED
@@ -1,86 +0,0 @@
1
- require 'spec_helper'
2
- require 'gorillib/object/blank'
3
-
4
- describe Object do
5
- it 'should provide blank?' do
6
- Object.new.should respond_to(:blank?)
7
- end
8
-
9
- it 'should be blank if it is nil' do
10
- object = Object.new
11
- class << object
12
- def nil?; true end
13
- end
14
- object.should be_blank
15
- end
16
-
17
- it 'should be blank if it is empty' do
18
- {}.should be_blank
19
- [].should be_blank
20
- end
21
-
22
- it 'should not be blank if not nil or empty' do
23
- Object.new.should_not be_blank
24
- [nil].should_not be_blank
25
- { nil => 0 }.should_not be_blank
26
- end
27
- end
28
-
29
- describe Numeric do
30
- it 'should provide blank?' do
31
- 1.should respond_to(:blank?)
32
- end
33
-
34
- it 'should never be blank' do
35
- 1.should_not be_blank
36
- end
37
- end
38
-
39
- describe NilClass do
40
- it 'should provide blank?' do
41
- nil.should respond_to(:blank?)
42
- end
43
-
44
- it 'should always be blank' do
45
- nil.should be_blank
46
- end
47
- end
48
-
49
- describe TrueClass do
50
- it 'should provide blank?' do
51
- true.should respond_to(:blank?)
52
- end
53
-
54
- it 'should never be blank' do
55
- true.should_not be_blank
56
- end
57
- end
58
-
59
- describe FalseClass do
60
- it 'should provide blank?' do
61
- false.should respond_to(:blank?)
62
- end
63
-
64
- it 'should always be blank' do
65
- false.should be_blank
66
- end
67
- end
68
-
69
- describe String do
70
- it 'should provide blank?' do
71
- 'string'.should respond_to(:blank?)
72
- end
73
-
74
- it 'should be blank if empty' do
75
- ''.should be_blank
76
- end
77
-
78
- it 'should be blank if it only contains whitespace' do
79
- ' '.should be_blank
80
- " \r \n \t ".should be_blank
81
- end
82
-
83
- it 'should not be blank if it contains non-whitespace' do
84
- ' a '.should_not be_blank
85
- end
86
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
- require 'gorillib/hash/deep_compact'
3
- require 'gorillib/array/deep_compact'
4
-
5
- describe Hash do
6
-
7
- it "should respond to the method deep_compact!" do
8
- { }.should respond_to :deep_compact!
9
- end
10
-
11
- it "should return nil if all values evaluate as blank" do
12
- { :a=>nil, :b=>"", :c=>[] }.deep_compact!.should be nil
13
- end
14
-
15
- it "should return a hash with all blank values removed recursively" do
16
- @test_hash = {:e=>["",nil,[],{},"foo",{:a=>[nil,{:c=>["","",[]]}],:b=>nil }]}
17
- @test_hash.deep_compact!.should == {:e=>["foo"]}
18
- end
19
-
20
- end
21
-
22
- describe Array do
23
-
24
- it "should respond to the method deep_compact!" do
25
- [ ].should respond_to :deep_compact!
26
- end
27
-
28
- it "should return nil if all values evaluate as blank" do
29
- [nil, '', { }].deep_compact!.should be nil
30
- end
31
-
32
- it "should return a hash with all blank values removed recursively" do
33
- @test_hash = ["",nil,[],{},"foo",{:a=>[nil,{:c=>["","",[]]}],:b=>nil }]
34
- @test_hash.deep_compact!.should == ["foo"]
35
- end
36
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "Gorillib" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
6
- end
7
- end
data/spec/rcov.opts DELETED
@@ -1,6 +0,0 @@
1
- --exclude "spec"
2
- --sort coverage
3
- --callsites
4
- --xrefs
5
- --profile
6
- --text-summary
data/spec/spec.opts DELETED
@@ -1,4 +0,0 @@
1
- --colour
2
- --loadby random
3
- --format profile
4
- --backtrace
data/spec/spec_tasks.rake DELETED
@@ -1,15 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rspec/core'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec) do |spec|
7
- spec.pattern = FileList['spec/**/*_spec.rb']
8
- end
9
-
10
- RSpec::Core::RakeTask.new(:rcov) do |spec|
11
- spec.pattern = 'spec/**/*_spec.rb'
12
- spec.rcov = true
13
- end
14
-
15
- task :default => :spec
@@ -1,25 +0,0 @@
1
- ORIG_ARGV = ARGV.dup
2
-
3
- curr = File.expand_path(File.dirname(__FILE__))
4
- $:.unshift(curr) unless $:.include?('curr') || $:.include?(curr)
5
- lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
6
- $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
7
-
8
- require 'test/unit'
9
-
10
- def with_kcode(code)
11
- if RUBY_VERSION < '1.9'
12
- begin
13
- old_kcode, $KCODE = $KCODE, code
14
- yield
15
- ensure
16
- $KCODE = old_kcode
17
- end
18
- else
19
- yield
20
- end
21
- end
22
-
23
- if RUBY_VERSION < '1.9'
24
- $KCODE = 'UTF8'
25
- end
@@ -1,33 +0,0 @@
1
- require File.dirname(__FILE__)+'/../abstract_unit'
2
- require 'gorillib/array/compact_blank'
3
-
4
- class ArrayCompactBlankTests < Test::Unit::TestCase
5
-
6
- def test_compact_blank_with_empty
7
- [ [nil], [nil, false, {}, ""] ].each do |arr|
8
- assert_equal([], arr.compact_blank)
9
- assert_not_equal(0, arr.length)
10
- end
11
- end
12
-
13
- def test_compact_blank_bang_with_empty
14
- assert_equal([], [].compact_blank!)
15
- #
16
- [ [nil], [nil, false, {}, ""] ].each do |arr|
17
- assert_equal([], arr.compact_blank!)
18
- assert_equal(0, arr.length)
19
- end
20
- end
21
-
22
- def test_compact_blank_with_full
23
- [ [nil, 1, nil, 2], [nil, 1, false, 2, {}, ""] ].each do |arr|
24
- assert_equal([1, 2], arr.compact_blank)
25
- end
26
- end
27
-
28
- def test_compact_blank_bang_with_full
29
- [ [nil, 1, nil, 2], [nil, 1, false, 2, {}, ""] ].each do |arr|
30
- assert_equal([1, 2], arr.compact_blank!)
31
- end
32
- end
33
- end