zucker 13.1 → 100.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +17 -2
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +22 -0
  5. data/Rakefile +17 -58
  6. data/doc/{zucker_doc.rb → create_documentation.rb} +67 -129
  7. data/doc/zucker.html +1774 -0
  8. data/lib/zucker.rb +12 -42
  9. data/lib/zucker/alias_for.rb +9 -16
  10. data/lib/zucker/all.rb +0 -2
  11. data/lib/zucker/array_op.rb +15 -0
  12. data/lib/zucker/blank.rb +39 -21
  13. data/lib/zucker/camel_snake.rb +15 -0
  14. data/lib/zucker/constantize.rb +29 -0
  15. data/lib/zucker/dir_extras.rb +20 -0
  16. data/lib/zucker/egonil.rb +13 -24
  17. data/lib/zucker/file_extras.rb +33 -0
  18. data/lib/zucker/hash_extras.rb +11 -0
  19. data/lib/zucker/hash_op.rb +28 -0
  20. data/lib/zucker/instance_variables_from.rb +34 -0
  21. data/lib/zucker/iterate.rb +24 -21
  22. data/lib/zucker/marshal_copy.rb +11 -0
  23. data/lib/zucker/mash.rb +22 -0
  24. data/lib/zucker/ords.rb +17 -0
  25. data/lib/zucker/regexp_union.rb +17 -0
  26. data/lib/zucker/square_brackets_for.rb +12 -15
  27. data/lib/zucker/string_extras.rb +15 -0
  28. data/lib/zucker/string_op.rb +20 -0
  29. data/lib/zucker/tap.rb +13 -8
  30. data/lib/zucker/unary_conversion.rb +25 -0
  31. data/spec/alias_for_spec.rb +11 -73
  32. data/spec/array_op_spec.rb +17 -0
  33. data/spec/blank_spec.rb +2 -0
  34. data/spec/camel_snake_spec.rb +15 -0
  35. data/spec/constantize_spec.rb +33 -0
  36. data/spec/dir_extras_spec.rb +32 -0
  37. data/spec/egonil_spec.rb +1 -0
  38. data/spec/file_extras_spec.rb +57 -0
  39. data/spec/hash_extras_spec.rb +11 -0
  40. data/spec/hash_op_spec.rb +28 -0
  41. data/spec/instance_variables_from_spec.rb +24 -0
  42. data/spec/iterate_spec.rb +2 -0
  43. data/spec/{mcopy_spec.rb → marshal_copy_spec.rb} +5 -3
  44. data/spec/mash_spec.rb +17 -0
  45. data/spec/ords_spec.rb +15 -0
  46. data/spec/{union_spec.rb → regexp_union_spec.rb} +4 -2
  47. data/spec/square_brackets_for_spec.rb +4 -12
  48. data/spec/string_extras_spec.rb +20 -0
  49. data/spec/string_op_spec.rb +22 -0
  50. data/spec/tap_spec.rb +2 -0
  51. data/spec/{unary_spec.rb → unary_conversion_spec.rb} +4 -2
  52. data/zucker.gemspec +8 -18
  53. metadata +75 -147
  54. data/.gemtest +0 -0
  55. data/README +0 -7
  56. data/desc/alias_for.yaml +0 -17
  57. data/desc/aliases.yaml +0 -18
  58. data/desc/array.yaml +0 -11
  59. data/desc/array_to_proc.yaml +0 -16
  60. data/desc/binding.yaml +0 -22
  61. data/desc/blank.yaml +0 -11
  62. data/desc/case.yaml +0 -9
  63. data/desc/cc.yaml +0 -10
  64. data/desc/class_to_proc.yaml +0 -11
  65. data/desc/dd.yaml +0 -23
  66. data/desc/egonil.yaml +0 -15
  67. data/desc/engine.yaml +0 -15
  68. data/desc/enumerable.yaml +0 -10
  69. data/desc/file.yaml +0 -14
  70. data/desc/hash.yaml +0 -14
  71. data/desc/hash_to_proc.yaml +0 -10
  72. data/desc/info.yaml +0 -20
  73. data/desc/iterate.yaml +0 -16
  74. data/desc/ivars.yaml +0 -19
  75. data/desc/kernel.yaml +0 -15
  76. data/desc/mcopy.yaml +0 -11
  77. data/desc/mm.yaml +0 -15
  78. data/desc/not.yaml +0 -11
  79. data/desc/oo.yaml +0 -10
  80. data/desc/os.yaml +0 -19
  81. data/desc/qq.yaml +0 -11
  82. data/desc/regexp_to_proc.yaml +0 -12
  83. data/desc/regexp_visualize.yaml +0 -23
  84. data/desc/ruby_version.yaml +0 -28
  85. data/desc/sandbox.yaml +0 -13
  86. data/desc/square_brackets_for.yaml +0 -22
  87. data/desc/string.yaml +0 -22
  88. data/desc/tap.yaml +0 -17
  89. data/desc/unary.yaml +0 -15
  90. data/desc/union.yaml +0 -10
  91. data/doc/zucker_doc.html +0 -3042
  92. data/lib/zucker/aliases.rb +0 -52
  93. data/lib/zucker/array.rb +0 -15
  94. data/lib/zucker/array_to_proc.rb +0 -19
  95. data/lib/zucker/binding.rb +0 -35
  96. data/lib/zucker/case.rb +0 -14
  97. data/lib/zucker/cc.rb +0 -31
  98. data/lib/zucker/class_to_proc.rb +0 -13
  99. data/lib/zucker/control.rb +0 -4
  100. data/lib/zucker/dd.rb +0 -24
  101. data/lib/zucker/debug.rb +0 -4
  102. data/lib/zucker/default.rb +0 -4
  103. data/lib/zucker/engine.rb +0 -70
  104. data/lib/zucker/enumerable.rb +0 -15
  105. data/lib/zucker/env.rb +0 -4
  106. data/lib/zucker/extensions.rb +0 -4
  107. data/lib/zucker/file.rb +0 -28
  108. data/lib/zucker/hash.rb +0 -28
  109. data/lib/zucker/hash_to_proc.rb +0 -17
  110. data/lib/zucker/info.rb +0 -193
  111. data/lib/zucker/ivars.rb +0 -29
  112. data/lib/zucker/kernel.rb +0 -42
  113. data/lib/zucker/mcopy.rb +0 -11
  114. data/lib/zucker/mm.rb +0 -41
  115. data/lib/zucker/not.rb +0 -20
  116. data/lib/zucker/object.rb +0 -4
  117. data/lib/zucker/oo.rb +0 -18
  118. data/lib/zucker/os.rb +0 -55
  119. data/lib/zucker/qq.rb +0 -13
  120. data/lib/zucker/regexp_to_proc.rb +0 -13
  121. data/lib/zucker/regexp_visualize.rb +0 -31
  122. data/lib/zucker/ruby_version.rb +0 -120
  123. data/lib/zucker/sandbox.rb +0 -17
  124. data/lib/zucker/shortcuts.rb +0 -4
  125. data/lib/zucker/string.rb +0 -55
  126. data/lib/zucker/to_proc.rb +0 -4
  127. data/lib/zucker/unary.rb +0 -25
  128. data/lib/zucker/union.rb +0 -17
  129. data/spec/aliases_spec.rb +0 -13
  130. data/spec/array_spec.rb +0 -16
  131. data/spec/array_to_proc_spec.rb +0 -12
  132. data/spec/binding_spec.rb +0 -6
  133. data/spec/case_spec.rb +0 -15
  134. data/spec/cc_spec.rb +0 -6
  135. data/spec/class_to_proc_spec.rb +0 -9
  136. data/spec/dd_spec.rb +0 -37
  137. data/spec/engine_spec.rb +0 -11
  138. data/spec/enumerable_spec.rb +0 -8
  139. data/spec/file_spec.rb +0 -46
  140. data/spec/hash_spec.rb +0 -25
  141. data/spec/hash_to_proc_spec.rb +0 -12
  142. data/spec/info_spec.rb +0 -8
  143. data/spec/ivars_spec.rb +0 -20
  144. data/spec/kernel_spec.rb +0 -42
  145. data/spec/mm_spec.rb +0 -6
  146. data/spec/not_spec.rb +0 -10
  147. data/spec/oo_spec.rb +0 -6
  148. data/spec/os_spec.rb +0 -37
  149. data/spec/qq_spec.rb +0 -19
  150. data/spec/regexp_to_proc_spec.rb +0 -9
  151. data/spec/regexp_visualize_spec.rb +0 -38
  152. data/spec/ruby_version_spec.rb +0 -55
  153. data/spec/sandbox_spec.rb +0 -14
  154. data/spec/string_spec.rb +0 -65
@@ -1,9 +0,0 @@
1
- require 'zucker/regexp_to_proc'
2
-
3
- describe 'Regexp#to_proc' do
4
- it 'should match the regex' do
5
- %w|just another string array|.map( &/[jy]/).should == ["j", nil, nil, "y"]
6
- %w|just another string array|.select( &/[jy]/).should == ["just", "array"]
7
- end
8
- end
9
-
@@ -1,38 +0,0 @@
1
- require 'zucker/regexp_visualize'
2
-
3
- describe 'Regexp#visualize' do
4
- let :regex do /\b([A-Z0-9._%+-]+)@([A-Z0-9.-]+\.[A-Z]{2,4})\b/i end # regex from regular-expressions.info/email.html
5
-
6
- it 'should display a string where >and< mark the found regex' do
7
- capture_stdout do
8
- regex.vis 'I do not contain an email address.'
9
- end.chomp.should == 'no match'
10
- end
11
-
12
- it 'should display "no match" if the regex could not be matched' do
13
- capture_stdout do
14
- regex.vis 'I contain an email address: mail@example.com'
15
- end.chomp.should == 'I contain an email address: >mail@example.com< '
16
- end
17
-
18
- it 'should display a string where >and< mark the found regex group if group identifier is given as arg2' do
19
- capture_stdout do
20
- regex.vis 'mail@example.com', 1
21
- end.chomp.should == '1: >mail< @example.com'
22
- end
23
-
24
- it 'should display "group identifier: no match" if the arg2 group could not be matched' do
25
- capture_stdout do
26
- regex.vis 'mail@example.com', 3
27
- end.chomp.should == '3: no match'
28
- end
29
-
30
- it 'should also take an array of group identfiers as arg2' do
31
- capture_stdout do
32
- regex.vis 'mail@example.com', [0,1,2]
33
- end.chomp.should == "0: >mail@example.com< \n"\
34
- "1: >mail< @example.com\n"\
35
- "2: mail@ >example.com< "
36
- end
37
- end
38
-
@@ -1,55 +0,0 @@
1
- require 'zucker/ruby_version'
2
- require 'date'
3
-
4
- describe 'RubyVersion' do
5
- before :all do
6
- @remember_version = RUBY_VERSION
7
- capture_stderr{ RUBY_VERSION = '1.8.7' }
8
- end
9
-
10
- it 'should display RUBY_VERSION if called directly (to_s)' do
11
- RubyVersion.to_s.should == '1.8.7'
12
- end
13
-
14
- context 'with "is" method, with parameter' do
15
- it 'should check for main version (1.8 or 1.9) when Float paramater is given' do
16
- RubyVersion.is?( 1.8 ).should == true
17
- RubyVersion.is?( 1.9 ).should == false
18
- end
19
-
20
- it 'should check with string comparison if parameter is not Float' do
21
- RubyVersion.is?( '1.8' ).should == false
22
- end
23
- end
24
-
25
- context 'with "is" method, without parameter, but method chaining' do
26
- it 'should return a string for usage with comparison operators' do
27
- (RubyVersion.is > '1.8.7').should == false
28
- (RubyVersion <= '1.8.7').should == true
29
- (RubyVersion.is.between? '1.8.6', '1.8.7').should == true
30
- end
31
-
32
- it 'should create some handy compare aliases' do
33
- RubyVersion.is.above( '1.8.7' ).should == false
34
- RubyVersion.is.at_least( '1.8.7' ).should == true
35
- RubyVersion.is.exactly( '1.8.7' ).should == true
36
- end
37
-
38
- it 'also allows to check for the release dates' do
39
- RubyVersion.is.older_than( Date.today ).should == true
40
- RubyVersion.is.newer_than( '2000-01-01' ).should == true
41
- end
42
- end
43
-
44
- it 'should define some accessors' do
45
- RubyVersion.major.should == 1
46
- RubyVersion.minor.should == 8
47
- RubyVersion.tiny.should == 7
48
- # RubyVersion.patchlevel # => RUBY_PATCHLEVEL
49
- # RubyVersion.description # => RUBY_DESCRIPTION
50
- end
51
-
52
- after :all do
53
- capture_stderr{ RUBY_VERSION = @remember_version }
54
- end
55
- end
data/spec/sandbox_spec.rb DELETED
@@ -1,14 +0,0 @@
1
- require 'zucker/sandbox'
2
-
3
- describe 'sandbox' do
4
- unless defined?(RUBY_ENGINE) && ( RUBY_ENGINE == 'jruby' || RUBY_ENGINE == 'rbx' )
5
- it 'should throw a SecurityError if bad commands are issued' do
6
- proc do
7
- sandbox do
8
- `ls`
9
- end
10
- end.should raise_exception SecurityError
11
- end
12
- end
13
- end
14
-
data/spec/string_spec.rb DELETED
@@ -1,65 +0,0 @@
1
- require 'zucker/string'
2
-
3
- describe 'String#-' do
4
- it 'should remove the applied Regexp or String from self via gsub' do
5
- ('1234abc5678' - 'b' - /\d/).should == 'ac'
6
- end
7
- end
8
-
9
- describe 'String#^' do
10
- it 'should give C-like substring access to strings' do
11
- string = 'Theoretische Informatik ist voll geil!'
12
-
13
- (string^0).should == 'Theoretische Informatik ist voll geil!'
14
- (string^1).should == 'heoretische Informatik ist voll geil!'
15
- (string^13).should == 'Informatik ist voll geil!'
16
- (string^-1).should == 'Theoretische Informatik ist voll geil'
17
- (string^38).should == ''
18
- (string^99).should == nil
19
- end
20
- end
21
-
22
- describe 'String#lchomp' do
23
- it 'should chomp on the left side' do
24
- string = 'Theoretische Informatik ist voll geil!'
25
- string.lchomp('T').should == 'heoretische Informatik ist voll geil!'
26
- end
27
- end
28
-
29
- describe 'String#ords' do
30
- it 'should unpack characters' do
31
- string = 'Theoretische Informatik ist voll geil!'
32
- string.ords.should == [84, 104, 101, 111, 114, 101, 116, 105, 115, 99, 104, 101, 32, 73, 110, 102, 111, 114, 109, 97, 116, 105, 107, 32, 105, 115, 116, 32, 118, 111, 108, 108, 32, 103, 101, 105, 108, 33]
33
- end
34
-
35
- describe 'String#constantize' do
36
- it 'should return the constant with that name' do
37
- 'Object'.constantize.should == Object
38
- end
39
-
40
- it 'should also work for nested constants' do
41
- 'Zucker::VERSION'.constantize.should == Zucker::VERSION
42
- end
43
-
44
- it 'should throw name error if constant does not exist (and no parameter is given)' do
45
- proc do
46
- 'ObfsefsefsefafesafaefRubyZuckerafdfselijfesject'.constantize
47
- end.should raise_exception NameError
48
- end
49
-
50
- it 'should call the block (and not raise an error) if constant does not exist and block given' do
51
- proc do
52
- 'ObfsefsefsefafesafaefRubyZuckerafdfselijfesject'.constantize do |string|
53
- Default = [1,2,3]
54
- end.should == [1,2,3]
55
- end.should_not raise_exception NameError
56
- end
57
-
58
- it 'should return the second parameter (and not raise an error) if constant does not exist and parameter given' do
59
- proc do
60
- 'ObfsefsefsefafesafaefRubyZuckerafdfselijfesject'.constantize(Array).should == Array
61
- end.should_not raise_exception NameError
62
- end
63
- end
64
- end
65
-