kyanite 0.5.17 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/History.txt +3 -0
  2. data/Manifest.txt +1 -4
  3. data/Rakefile.rb +4 -4
  4. data/console.rb +9 -0
  5. data/lib/kyanite.rb +1 -2
  6. data/lib/kyanite/array/array.rb +4 -4
  7. data/lib/kyanite/array/array2.rb +4 -2
  8. data/lib/kyanite/basics.rb +1 -3
  9. data/lib/kyanite/dictionary.rb +6 -5
  10. data/lib/kyanite/enumerable/enumerable_enumerables.rb +6 -5
  11. data/lib/kyanite/enumerable/enumerable_numerics.rb +13 -13
  12. data/lib/kyanite/general.rb +0 -1
  13. data/lib/kyanite/general/classutils.rb +10 -12
  14. data/lib/kyanite/general/object.rb +13 -13
  15. data/lib/kyanite/hash.rb +9 -8
  16. data/lib/kyanite/numeric/integer.rb +4 -4
  17. data/lib/kyanite/numeric/numeric.rb +4 -3
  18. data/lib/kyanite/operation/regexp.rb +4 -3
  19. data/lib/kyanite/range.rb +29 -8
  20. data/lib/kyanite/set.rb +30 -19
  21. data/lib/kyanite/string/cast.rb +9 -9
  22. data/lib/kyanite/string/chars.rb +16 -16
  23. data/lib/kyanite/string/chars_const.rb +30 -20
  24. data/lib/kyanite/string/diff.rb +15 -15
  25. data/lib/kyanite/string/div.rb +6 -4
  26. data/lib/kyanite/string/include.rb +6 -6
  27. data/lib/kyanite/string/list.rb +8 -7
  28. data/lib/kyanite/string/mgsub.rb +5 -5
  29. data/lib/kyanite/string/nested.rb +10 -9
  30. data/lib/kyanite/string/random.rb +5 -5
  31. data/lib/kyanite/string/split.rb +12 -11
  32. data/lib/kyanite/tree.rb +1 -1
  33. data/test/_start_all.rb +2 -1
  34. data/test/array/test_matrix2.rb +2 -1
  35. data/test/general/test_classutils.rb +2 -0
  36. data/test/general/test_true_false.rb +1 -1
  37. data/test/test_dictionary.rb +1 -1
  38. data/test/test_hash.rb +1 -1
  39. data/test/test_optimizer.rb +1 -1
  40. data/test/test_range.rb +1 -1
  41. data/test/test_set.rb +2 -1
  42. data/test/test_tree.rb +1 -1
  43. metadata +19 -7
  44. data/lib/kyanite/general/nil.rb +0 -88
  45. data/lib/kyanite/nil.rb +0 -3
  46. data/script/console.rb +0 -10
  47. data/test/general/test_nil.rb +0 -48
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.6.0 2012-10-15
2
+ * improved nil-Handling
3
+
1
4
  == 0.5.13 2012-10-09
2
5
  * Rakefile: publish project & docs on github & rubygems
3
6
 
data/Manifest.txt CHANGED
@@ -1,3 +1,4 @@
1
+ console.rb
1
2
  Div
2
3
  History.txt
3
4
  License.txt
@@ -24,14 +25,12 @@ lib/kyanite/general.rb
24
25
  lib/kyanite/general/callerutils.rb
25
26
  lib/kyanite/general/classutils.rb
26
27
  lib/kyanite/general/kernel.rb
27
- lib/kyanite/general/nil.rb
28
28
  lib/kyanite/general/object.rb
29
29
  lib/kyanite/general/true_false.rb
30
30
  lib/kyanite/general/undoable.rb
31
31
  lib/kyanite/hash.rb
32
32
  lib/kyanite/hoe.rb
33
33
  lib/kyanite/matrix2.rb
34
- lib/kyanite/nil.rb
35
34
  lib/kyanite/numeric.rb
36
35
  lib/kyanite/numeric/float.rb
37
36
  lib/kyanite/numeric/integer.rb
@@ -63,7 +62,6 @@ lib/kyanite/symbol.rb
63
62
  lib/kyanite/tree.rb
64
63
  lib/kyanite/undoable.rb
65
64
  lib/kyanite/unit_test.rb
66
- script/console.rb
67
65
  test/_start_all.rb
68
66
  test/array/test_array.rb
69
67
  test/array/test_matrix2.rb
@@ -72,7 +70,6 @@ test/enumerable/test_enumerable_numerics.rb
72
70
  test/enumerable/test_enumerable_strings.rb
73
71
  test/enumerable/test_structure.rb
74
72
  test/general/test_classutils.rb
75
- test/general/test_nil.rb
76
73
  test/general/test_object.rb
77
74
  test/general/test_true_false.rb
78
75
  test/numeric/test_numeric_integer.rb
data/Rakefile.rb CHANGED
@@ -24,12 +24,12 @@ $hoe = Hoe.spec Kyanite.projectname do
24
24
 
25
25
  developer('Bjoern Klippstein', 'klippstein@klippstein.com')
26
26
  summary = 'General toolbox like Facets or ActiveSupport.'
27
- urls << ["http://#{Kyanite::github_username}.github.com/#{Kyanite.projectname}/"]
28
- remote_rdoc_dir = '' # Release to root only one project
27
+ extra_deps << ['transparent_nil', '>= 0.1.3']
29
28
  extra_deps << ['activesupport', '>= 3.2.8']
30
29
  extra_deps << ['facets', '>= 2.9.3']
31
30
  extra_deps << ['rubytree', '>= 0.8.3']
32
-
31
+ remote_rdoc_dir = '' # Release to root only one project
32
+ urls = [["http://#{Kyanite.github_username}.github.com/#{Kyanite.projectname}/"]]
33
33
 
34
34
 
35
35
  end
@@ -91,7 +91,7 @@ remove_task 'deps:email'
91
91
  remove_task 'install_gem'
92
92
  remove_task 'multi'
93
93
  remove_task 'newb'
94
- Dir['tasks/**/*.rake'].each { |t| load t }
94
+ #Dir['tasks/**/*.rake'].each { |t| load t }
95
95
 
96
96
 
97
97
 
data/console.rb ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+ libs = " -r irb/completion"
5
+ libs << " -r #{File.dirname(__FILE__) + '/init.rb'}"
6
+
7
+ puts "Welcome to Kyanite gem"
8
+
9
+ exec "#{irb} #{libs} --simple-prompt --noreadline"
data/lib/kyanite.rb CHANGED
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  module Kyanite #:nodoc
18
18
 
19
- VERSION = '0.5.17'
19
+ VERSION = '0.6.0'
20
20
 
21
21
  end
22
22
 
@@ -28,7 +28,6 @@ end
28
28
  require 'kyanite/general'
29
29
  require 'kyanite/hash'
30
30
  # require 'kyanite/matrix2' # ist schon in array
31
- # require 'kyanite/nil' # ist schon in general
32
31
  require 'kyanite/numeric'
33
32
  # require 'kyanite/operation' # nur manuell
34
33
  require 'kyanite/optimizer'
@@ -113,11 +113,11 @@ end # class Array
113
113
 
114
114
 
115
115
 
116
-
117
- class NilClass
118
- def shift_complement; nil; end
116
+ if defined? TransparentNil
117
+ class NilClass
118
+ def shift_complement; nil; end
119
+ end
119
120
  end
120
-
121
121
 
122
122
 
123
123
 
@@ -14,8 +14,10 @@ class Array
14
14
 
15
15
  end
16
16
 
17
- class NilClass
18
- def row_to_nil; nil; end
17
+ if defined? TransparentNil
18
+ class NilClass
19
+ def row_to_nil; nil; end
20
+ end
19
21
  end
20
22
 
21
23
  # Ein Array2 ist eine spezielle Form von Array, nämlich immer zweidimensional. Siehe auch Matrix2!
@@ -12,8 +12,7 @@
12
12
  # require 'kyanite/general'
13
13
  # require 'kyanite/general/callerutils'
14
14
  require 'kyanite/general/classutils'
15
- require 'kyanite/general/kernel'
16
- require 'kyanite/general/nil'
15
+ require 'kyanite/general/kernel'
17
16
  require 'kyanite/general/object'
18
17
  # require 'kyanite/general/optimizer'
19
18
  require 'kyanite/general/true_false'
@@ -45,7 +44,6 @@
45
44
  # require 'kyanite/dictionary'
46
45
  require 'kyanite/hash'
47
46
  # require 'kyanite/matrix2'
48
- # require 'kyanite/nil' # ist schon in general
49
47
  require 'kyanite/range'
50
48
  # require 'kyanite/set'
51
49
  require 'kyanite/symbol'
@@ -94,17 +94,18 @@ class Array
94
94
  end
95
95
 
96
96
 
97
- class NilClass
97
+ if defined? TransparentNil
98
+ class NilClass
98
99
 
99
- # Rückgabe: Leeres Dictionary
100
- def to_dictionary; Dictionary.new; end
100
+ # Rückgabe: Leeres Dictionary
101
+ def to_dictionary; Dictionary.new; end
101
102
 
102
- def fetch_by_index(*a); nil; end
103
+ def fetch_by_index(*a); nil; end
103
104
 
105
+ end
104
106
  end
105
107
 
106
108
 
107
-
108
109
  # ---------------------------------------------------------
109
110
  # Ausprobieren
110
111
  #
@@ -68,14 +68,15 @@ class Array
68
68
  end
69
69
 
70
70
 
71
- class NilClass
72
- def transpose!; nil; end
73
- def transpose; nil; end
74
- def rectangle; nil; end
71
+ if defined? TransparentNil
72
+ class NilClass
73
+ def transpose!; nil; end
74
+ def transpose; nil; end
75
+ def rectangle; nil; end
76
+ end
75
77
  end
76
78
 
77
79
 
78
80
 
79
81
 
80
82
 
81
-
@@ -138,21 +138,21 @@ class Array
138
138
  end
139
139
 
140
140
 
141
-
142
- class NilClass
143
- def average; nil; end
144
- def avg; nil; end
145
- def mean; nil; end
146
- def mean_arithmetric; nil; end
147
- def mean_geometric; nil; end
148
- def mean_harmonic(*a); nil; end
149
- def parallel(*a); nil; end
150
- def prd; nil; end
151
- def sum; nil; end
152
- def summation; nil; end
141
+ if defined? TransparentNil
142
+ class NilClass
143
+ def average; nil; end
144
+ def avg; nil; end
145
+ def mean; nil; end
146
+ def mean_arithmetric; nil; end
147
+ def mean_geometric; nil; end
148
+ def mean_harmonic(*a); nil; end
149
+ def parallel(*a); nil; end
150
+ def prd; nil; end
151
+ def sum; nil; end
152
+ def summation; nil; end
153
+ end
153
154
  end
154
155
 
155
-
156
156
  # ==================================================================================
157
157
  # Ausprobieren
158
158
  #
@@ -2,7 +2,6 @@
2
2
  require 'kyanite/general/callerutils'
3
3
  require 'kyanite/general/classutils'
4
4
  require 'kyanite/general/kernel'
5
- require 'kyanite/general/nil'
6
5
  require 'kyanite/general/object'
7
6
  require 'kyanite/general/true_false'
8
7
  require 'kyanite/general/undoable'
@@ -195,21 +195,19 @@ class String
195
195
 
196
196
  end # class
197
197
 
198
+ if defined? TransparentNil
199
+ class NilClass
198
200
 
199
- class NilClass
201
+ # Rückgabe: Leerer String
202
+ def to_classname; ''; end
200
203
 
201
- # Rückgabe: Leerer String
202
- def to_classname; ''; end
203
-
204
- def camelize; nil; end
205
- def constantize; nil; end
206
- def demodulize; nil; end
207
- def to_class; nil; end
208
- def underscore; nil; end
209
-
210
-
211
-
204
+ def camelize; nil; end
205
+ def constantize; nil; end
206
+ def demodulize; nil; end
207
+ def to_class; nil; end
208
+ def underscore; nil; end
212
209
 
210
+ end
213
211
  end
214
212
 
215
213
 
@@ -85,21 +85,21 @@ end
85
85
 
86
86
 
87
87
 
88
-
89
- class NilClass
90
-
91
- # Rückgabe: false
92
- def blank?; false; end
93
-
94
- # Rückgabe: false
95
- def is_numeric?; false; end
96
-
97
- def to_nil; nil; end
98
- def to_nil_unless(*a); nil; end
99
- def name_of_constant(*a); nil; end
88
+ if defined? TransparentNil
89
+ class NilClass
90
+
91
+ # Rückgabe: false
92
+ def blank?; false; end
93
+
94
+ # Rückgabe: false
95
+ def is_numeric?; false; end
96
+
97
+ def to_nil; nil; end
98
+ def to_nil_unless(*a); nil; end
99
+ def name_of_constant(*a); nil; end
100
+ end
100
101
  end
101
102
 
102
103
 
103
104
 
104
105
 
105
-
data/lib/kyanite/hash.rb CHANGED
@@ -148,14 +148,15 @@ class Hash
148
148
 
149
149
  end #class
150
150
 
151
-
152
- class NilClass
153
- def compact_keys!; nil; end
154
- def compact_values!; nil; end
155
- def delete_key(*a); nil; end
156
- def delete_value(*a); nil; end
157
- def arrayize(*a); nil; end
158
- def fuzzyget(*a); nil; end
151
+ if defined? TransparentNil
152
+ class NilClass
153
+ def compact_keys!; nil; end
154
+ def compact_values!; nil; end
155
+ def delete_key(*a); nil; end
156
+ def delete_value(*a); nil; end
157
+ def arrayize(*a); nil; end
158
+ def fuzzyget(*a); nil; end
159
+ end
159
160
  end
160
161
 
161
162
 
@@ -32,10 +32,10 @@ class Integer
32
32
  end # class
33
33
 
34
34
 
35
-
36
- class NilClass
37
- def to_time; nil; end
35
+ if defined? TransparentNil
36
+ class NilClass
37
+ def to_time; nil; end
38
+ end
38
39
  end
39
40
 
40
41
 
41
-
@@ -47,7 +47,8 @@ class Numeric
47
47
 
48
48
  end # class
49
49
 
50
-
51
- class NilClass
52
- def substract(other); nil; end
50
+ if defined? TransparentNil
51
+ class NilClass
52
+ def substract(other); nil; end
53
+ end
53
54
  end
@@ -19,9 +19,10 @@ class String
19
19
 
20
20
  end
21
21
 
22
-
23
- class NilClass
24
- def show_regexp(*a); nil; end
22
+ if defined? TransparentNil
23
+ class NilClass
24
+ def show_regexp(*a); nil; end
25
+ end
25
26
  end
26
27
 
27
28
 
data/lib/kyanite/range.rb CHANGED
@@ -1,4 +1,9 @@
1
1
  # ruby encoding: utf-8
2
+ # ü
3
+ if $0 == __FILE__
4
+ require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
+ smart_load_path
6
+ end
2
7
  require 'facets/range/combine'
3
8
  require 'facets/range/within'
4
9
  require 'kyanite/enumerable' # is_collection? ist für Ranges false
@@ -46,16 +51,32 @@ end # class
46
51
 
47
52
 
48
53
 
54
+ if defined? TransparentNil
55
+ class NilClass
56
+ def invert_index; nil; end
57
+ def umbrella(*a); nil; end
58
+ def combine(*a); nil; end
59
+ def within?(*a); nil; end
60
+ end
61
+ end # if defined? TransparentNil
62
+
63
+ # ==================================================================================
64
+ # Ausprobieren
65
+ #
66
+ if $0 == __FILE__
49
67
 
50
- class NilClass
51
- def invert_index; nil; end
52
- def umbrella(*a); nil; end
53
- def combine(*a); nil; end
54
- def within?(*a); nil; end
55
- end
56
68
 
57
-
58
-
69
+ # puts TransparentNil::VERSION
70
+ puts (nil.respond_to? :invert_index).inspect
71
+ # puts nil.invert_index
72
+
73
+ # test = [:a, :b, :c].to_ordered_set
74
+ # see :test # .inspect_see
75
+ # see_pp test
76
+ # seee.process_print( test, :method => :pp )
77
+ # see :test# .inspect_see
78
+
79
+ end
59
80
 
60
81
 
61
82
 
data/lib/kyanite/set.rb CHANGED
@@ -1,4 +1,10 @@
1
1
  # ruby encoding: utf-8
2
+ # ü
3
+ if $0 == __FILE__
4
+ require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
+ smart_load_path
6
+ end
7
+
2
8
  require 'set'
3
9
  require 'kyanite/enumerable' # is_collection?
4
10
  require 'kyanite/general/kernel' # silence_warnings
@@ -199,29 +205,31 @@ class Array
199
205
  end # class
200
206
 
201
207
 
208
+ class Object
202
209
 
210
+ # Liefert ein Set mit einem Element
211
+ #
212
+ def to_set; Set.new([self]); end
213
+
214
+ end
203
215
 
204
- class NilClass
205
216
 
206
- # Rückgabe: Leeres Set
207
- def to_set; Set.new; end
217
+ if defined? TransparentNil
218
+ class NilClass
208
219
 
209
- # Rückgabe: Leeres SortedSet
210
- def to_sorted_set; SortedSet.new; end
220
+ # Rückgabe: Leeres Set
221
+ def to_set; Set.new; end
211
222
 
212
- # Rückgabe: Leeres OrderedSet
213
- def to_ordered_set; OrderedSet.new; end
214
- end
223
+ # Rückgabe: Leeres SortedSet
224
+ def to_sorted_set; SortedSet.new; end
215
225
 
226
+ # Rückgabe: Leeres OrderedSet
227
+ def to_ordered_set; OrderedSet.new; end
228
+ end
229
+ end
216
230
 
217
231
 
218
- class Object
219
232
 
220
- # Liefert ein Set mit einem Element
221
- #
222
- def to_set; Set.new([self]); end
223
-
224
- end
225
233
 
226
234
 
227
235
  # ==================================================================================
@@ -229,11 +237,14 @@ end
229
237
  #
230
238
  if $0 == __FILE__
231
239
 
232
- test = [:a, :b, :c].to_ordered_set
233
- see :test # .inspect_see
234
- see_pp test
235
- seee.process_print( test, :method => :pp )
236
- see :test# .inspect_see
240
+
241
+ puts nil.to_set
242
+
243
+ # test = [:a, :b, :c].to_ordered_set
244
+ # see :test # .inspect_see
245
+ # see_pp test
246
+ # seee.process_print( test, :method => :pp )
247
+ # see :test# .inspect_see
237
248
 
238
249
  end
239
250
 
@@ -100,16 +100,16 @@ class String
100
100
 
101
101
  end
102
102
 
103
-
104
- class NilClass
105
- def to_identifier; nil; end
106
- def to_integer; nil; end
107
- def to_integer_optional; nil; end
108
- def to_nil(*a); nil; end
109
- def to_x; nil; end
110
- def from_x; nil; end
103
+ if defined? TransparentNil
104
+ class NilClass
105
+ def to_identifier; nil; end
106
+ def to_integer; nil; end
107
+ def to_integer_optional; nil; end
108
+ def to_nil(*a); nil; end
109
+ def to_x; nil; end
110
+ def from_x; nil; end
111
+ end
111
112
  end
112
113
 
113
114
 
114
115
 
115
-
@@ -160,24 +160,24 @@ end
160
160
 
161
161
 
162
162
 
163
-
164
- class NilClass
165
-
166
- # Rückgabe: false
167
- def capitalized?; false; end
168
-
169
- def reduce94; nil; end
170
- def reduce94!; nil; end
171
- def reduce53; nil; end
172
- def reduce53!; nil; end
173
- def downcase2; nil; end
174
- def downcase2!; nil; end
175
- def mysqlize; nil; end
176
- def upcase2; nil; end
177
- def upcase2!; nil; end
163
+ if defined? TransparentNil
164
+ class NilClass
165
+
166
+ # Rückgabe: false
167
+ def capitalized?; false; end
168
+
169
+ def reduce94; nil; end
170
+ def reduce94!; nil; end
171
+ def reduce53; nil; end
172
+ def reduce53!; nil; end
173
+ def downcase2; nil; end
174
+ def downcase2!; nil; end
175
+ def mysqlize; nil; end
176
+ def upcase2; nil; end
177
+ def upcase2!; nil; end
178
+ end
178
179
  end
179
180
 
180
-
181
181
  # -----------------------------------------------------------------------------------------
182
182
  # Ausprobieren
183
183
  #
@@ -1,7 +1,11 @@
1
1
  # ruby encoding: utf-8
2
2
 
3
+ if $0 == __FILE__
4
+ require File.join(File.dirname(__FILE__), '..', '..', '..', 'smart_load_path.rb' )
5
+ smart_load_path
6
+ end
7
+
3
8
  require 'hashery'
4
- require 'kyanite/nil'
5
9
  require 'kyanite/string/div'
6
10
 
7
11
 
@@ -72,8 +76,10 @@ unless defined?(TR_UPCASE_ALL_REGEXP)
72
76
  # Spaces entfernen
73
77
  allkeys.split(//).each do |key|
74
78
  next unless base[key]
75
- base[key].strip!.gsub!(' ','').gsub!(' ','')
76
- base[key.upcase].strip!.gsub!(' ','').gsub!(' ','')
79
+ next if base[key].nil?
80
+ # base[key].strip!.gsub!(' ','').gsub!(' ','')
81
+ base[key].strip!.gsub!(' ','')
82
+ base[key.upcase].strip!.gsub!(' ','')
77
83
  end
78
84
 
79
85
 
@@ -145,26 +151,30 @@ end # unless defined?
145
151
  #
146
152
  if $0 == __FILE__ then
147
153
 
148
- require 'perception'
149
- rawlog "\n----------------------------------------------------------\n\n"
154
+
155
+ puts TR_DOWNCASE_ONLY.inspect
156
+
157
+
158
+ # require 'perception'
159
+ # rawlog "\n----------------------------------------------------------\n\n"
150
160
 
151
- rawlog 'TR_DOWNCASE_ONLY= '
152
- rawlog TR_DOWNCASE_ONLY
153
- rawlog "\n"
161
+ # rawlog 'TR_DOWNCASE_ONLY= '
162
+ # rawlog TR_DOWNCASE_ONLY
163
+ # rawlog "\n"
154
164
 
155
- rawlog 'TR_FULL= '
156
- rawlog TR_FULL
157
- rawlog "\n"
158
- rawlog 'TR_REDUCED= '
159
- rawlog TR_REDUCED
160
- rawlog "\n"
165
+ # rawlog 'TR_FULL= '
166
+ # rawlog TR_FULL
167
+ # rawlog "\n"
168
+ # rawlog 'TR_REDUCED= '
169
+ # rawlog TR_REDUCED
170
+ # rawlog "\n"
161
171
 
162
- rawlog 'TR_UPCASE= '
163
- rawlog TR_UPCASE
164
- rawlog "\n"
165
- rawlog 'TR_DOWNCASE= '
166
- rawlog TR_DOWNCASE
167
- rawlog "\n"
172
+ # rawlog 'TR_UPCASE= '
173
+ # rawlog TR_UPCASE
174
+ # rawlog "\n"
175
+ # rawlog 'TR_DOWNCASE= '
176
+ # rawlog TR_DOWNCASE
177
+ # rawlog "\n"
168
178
 
169
179
 
170
180
 
@@ -64,24 +64,24 @@ class String
64
64
  end
65
65
 
66
66
 
67
-
68
- class NilClass
69
-
70
- # Rückgabe: Leerer String,
71
- # siehe String#overlap
72
- def overlap(*a); ''; end
73
-
74
- # Rückgabe: b,
75
- # siehe String#diff
76
- def diff(b); b; end
77
-
78
- # Rückgabe: ['', b],
79
- # siehe String#overlapdiff
80
- def overlapdiff(b); ['', b]; end
67
+ if defined? TransparentNil
68
+ class NilClass
69
+
70
+ # Rückgabe: Leerer String,
71
+ # siehe String#overlap
72
+ def overlap(*a); ''; end
73
+
74
+ # Rückgabe: b,
75
+ # siehe String#diff
76
+ def diff(b); b; end
77
+
78
+ # Rückgabe: ['', b],
79
+ # siehe String#overlapdiff
80
+ def overlapdiff(b); ['', b]; end
81
+ end
81
82
  end
82
83
 
83
84
 
84
85
 
85
86
 
86
87
 
87
-
@@ -18,9 +18,11 @@ class String
18
18
  end
19
19
 
20
20
 
21
- class NilClass
21
+ if defined? TransparentNil
22
+ class NilClass
22
23
 
23
- # Rückgabe: 0
24
- def count_words; 0; end
25
-
24
+ # Rückgabe: 0
25
+ def count_words; 0; end
26
+
27
+ end
26
28
  end
@@ -26,15 +26,15 @@ class String
26
26
  end # def
27
27
  end
28
28
 
29
+ if defined? TransparentNil
30
+ class NilClass
29
31
 
30
- class NilClass
31
-
32
- # Rückgabe: false
33
- # redundante Definition!
34
- def include?(*a); false; end
32
+ # Rückgabe: false
33
+ # redundante Definition!
34
+ def include?(*a); false; end
35
+ end
35
36
  end
36
37
 
37
-
38
38
  # -----------------------------------------------------------------------------------------
39
39
  # ausprobieren
40
40
  #
@@ -1,5 +1,5 @@
1
1
  # ruby encoding: utf-8
2
- require 'kyanite/nil'
2
+ require 'transparent_nil'
3
3
  require 'kyanite/symbol'
4
4
 
5
5
  class String
@@ -24,7 +24,7 @@ class String
24
24
 
25
25
  # einzelnen String oder einzelnes Symbol angegeben -> ohne Separator ausgeben
26
26
  if elemente.kind_of?(String) || !elemente.respond_to?(:each_index)
27
- e = elemente.dup
27
+ e = elemente.dup
28
28
  e = yield e if block_given?
29
29
  return "#{self}#{options[:pre]}#{e}#{options[:post]}"
30
30
  end
@@ -75,10 +75,11 @@ class String
75
75
 
76
76
  end
77
77
 
78
-
79
- class NilClass
80
- def list_with(*a); nil; end
81
- def sql_regexp_for_kommaliste; nil; end
82
- def enum_to_array; nil; end
78
+ if defined? TransparentNil
79
+ class NilClass
80
+ def list_with(*a); nil; end
81
+ def sql_regexp_for_kommaliste; nil; end
82
+ def enum_to_array; nil; end
83
+ end
83
84
  end
84
85
 
@@ -26,11 +26,11 @@ class String
26
26
 
27
27
  end # class
28
28
 
29
-
30
- class NilClass
31
- def mgsub(*a); nil; end
32
- end
33
-
29
+ if defined? TransparentNil
30
+ class NilClass
31
+ def mgsub(*a); nil; end
32
+ end
33
+ end
34
34
 
35
35
 
36
36
  # -----------------------------------------------------------------------------------------
@@ -217,18 +217,19 @@ class String
217
217
  end # class
218
218
 
219
219
 
220
- class NilClass
221
-
222
- # Rückgabe: 0
223
- def nestinglevel; 0; end
224
-
225
- def anti; nil; end
226
- def index_bracket; nil; end
227
- def mask(*a); nil; end
220
+ if defined? TransparentNil
221
+ class NilClass
222
+
223
+ # Rückgabe: 0
224
+ def nestinglevel; 0; end
225
+
226
+ def anti; nil; end
227
+ def index_bracket; nil; end
228
+ def mask(*a); nil; end
229
+ end
228
230
  end
229
231
 
230
232
 
231
-
232
233
  # ------------------------------------------------------------------------------
233
234
  # Tests
234
235
  #
@@ -66,9 +66,9 @@ class String
66
66
 
67
67
  end
68
68
 
69
-
70
- class NilClass
71
- def shuffle; nil; end
72
- def shuffle!; nil; end
69
+ if defined? TransparentNil
70
+ class NilClass
71
+ def shuffle; nil; end
72
+ def shuffle!; nil; end
73
+ end
73
74
  end
74
-
@@ -129,16 +129,17 @@ class String
129
129
  end
130
130
 
131
131
 
132
- class NilClass
132
+ if defined? TransparentNil
133
+ class NilClass
133
134
 
134
- # Rückgabe: Leerer String,
135
- # siehe String#split
136
- def cut(*a); ''; end
137
-
138
- def nchar(*a); nil; end
139
- def split_by_index(*a); nil; end
140
- def extract(*a); nil; end
141
- def split_numeric; nil; end
142
- def without_versioninfo; nil; end
135
+ # Rückgabe: Leerer String,
136
+ # siehe String#split
137
+ def cut(*a); ''; end
138
+
139
+ def nchar(*a); nil; end
140
+ def split_by_index(*a); nil; end
141
+ def extract(*a); nil; end
142
+ def split_numeric; nil; end
143
+ def without_versioninfo; nil; end
144
+ end
143
145
  end
144
-
data/lib/kyanite/tree.rb CHANGED
@@ -5,7 +5,7 @@ if $0 == __FILE__
5
5
  end
6
6
 
7
7
  require 'rubytree'
8
- require 'kyanite/nil'
8
+ require 'transparent_nil'
9
9
 
10
10
 
11
11
  module Tree #:nodoc:
data/test/_start_all.rb CHANGED
@@ -9,7 +9,8 @@
9
9
  smart_load_path
10
10
  end
11
11
 
12
-
12
+ require 'transparent_nil'
13
+
13
14
  # Test-Verzeichnis der Applikation
14
15
  test_verzeichnis = File.expand_path(File.dirname(__FILE__) )
15
16
 
@@ -5,9 +5,10 @@ if $0 == __FILE__
5
5
  smart_load_path
6
6
  end
7
7
 
8
+ require 'transparent_nil' unless defined? TransparentNil
8
9
  require 'kyanite/unit_test'
9
10
  require 'kyanite/matrix2'
10
- require 'kyanite/general/nil'
11
+ require 'transparent_nil'
11
12
 
12
13
  # require 'benchmark'
13
14
  # include Benchmark
@@ -5,9 +5,11 @@ if $0 == __FILE__
5
5
  smart_load_path
6
6
  end
7
7
 
8
+ require 'transparent_nil' unless defined? TransparentNil
8
9
  require 'kyanite/unit_test'
9
10
  require 'kyanite/general/classutils'
10
11
 
12
+
11
13
  class DummyClass1 # :nodoc:
12
14
  end
13
15
  module DummyModule # :nodoc:
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  require 'kyanite/unit_test'
9
9
  require 'kyanite/general/true_false'
10
- require 'kyanite/general/nil'
10
+
11
11
 
12
12
  # Tests for TrueClass, FalseClass
13
13
  class TestKyaniteTrueFalse < UnitTest
@@ -1,7 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
4
+ require File.join(File.dirname(__FILE__), '..', 'smart_load_path.rb' )
5
5
  smart_load_path
6
6
  end
7
7
 
data/test/test_hash.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
4
+ require File.join(File.dirname(__FILE__), '..', 'smart_load_path.rb' )
5
5
  smart_load_path
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
4
+ require File.join(File.dirname(__FILE__), '..', 'smart_load_path.rb' )
5
5
  smart_load_path
6
6
  end
7
7
 
data/test/test_range.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
4
+ require File.join(File.dirname(__FILE__), '..', 'smart_load_path.rb' )
5
5
  smart_load_path
6
6
  end
7
7
 
data/test/test_set.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
4
+ require File.join(File.dirname(__FILE__), '..', 'smart_load_path.rb' )
5
5
  smart_load_path
6
6
  end
7
7
 
8
+ require 'transparent_nil' unless defined? TransparentNil
8
9
  require 'kyanite/unit_test'
9
10
  require 'kyanite/set'
10
11
 
data/test/test_tree.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
4
+ require File.join(File.dirname(__FILE__), '..', 'smart_load_path.rb' )
5
5
  smart_load_path
6
6
  end
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kyanite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.17
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000 Z
12
+ date: 2012-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: transparent_nil
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.1.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.3
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: activesupport
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -102,6 +118,7 @@ extra_rdoc_files:
102
118
  - Manifest.txt
103
119
  - README.txt
104
120
  files:
121
+ - console.rb
105
122
  - Div
106
123
  - History.txt
107
124
  - License.txt
@@ -128,14 +145,12 @@ files:
128
145
  - lib/kyanite/general/callerutils.rb
129
146
  - lib/kyanite/general/classutils.rb
130
147
  - lib/kyanite/general/kernel.rb
131
- - lib/kyanite/general/nil.rb
132
148
  - lib/kyanite/general/object.rb
133
149
  - lib/kyanite/general/true_false.rb
134
150
  - lib/kyanite/general/undoable.rb
135
151
  - lib/kyanite/hash.rb
136
152
  - lib/kyanite/hoe.rb
137
153
  - lib/kyanite/matrix2.rb
138
- - lib/kyanite/nil.rb
139
154
  - lib/kyanite/numeric.rb
140
155
  - lib/kyanite/numeric/float.rb
141
156
  - lib/kyanite/numeric/integer.rb
@@ -167,7 +182,6 @@ files:
167
182
  - lib/kyanite/tree.rb
168
183
  - lib/kyanite/undoable.rb
169
184
  - lib/kyanite/unit_test.rb
170
- - script/console.rb
171
185
  - test/_start_all.rb
172
186
  - test/array/test_array.rb
173
187
  - test/array/test_matrix2.rb
@@ -176,7 +190,6 @@ files:
176
190
  - test/enumerable/test_enumerable_strings.rb
177
191
  - test/enumerable/test_structure.rb
178
192
  - test/general/test_classutils.rb
179
- - test/general/test_nil.rb
180
193
  - test/general/test_object.rb
181
194
  - test/general/test_true_false.rb
182
195
  - test/numeric/test_numeric_integer.rb
@@ -228,7 +241,6 @@ test_files:
228
241
  - test/enumerable/test_enumerable_strings.rb
229
242
  - test/enumerable/test_structure.rb
230
243
  - test/general/test_classutils.rb
231
- - test/general/test_nil.rb
232
244
  - test/general/test_object.rb
233
245
  - test/general/test_true_false.rb
234
246
  - test/numeric/test_numeric_integer.rb
@@ -1,88 +0,0 @@
1
- # ruby encoding: utf-8
2
- # [ | *Kyanite* | Object | Array | Set | Enumerable | Hash | ] | Kyanite | TrueClass | FalseClass | *NilClass* | Div |
3
- #
4
- # ---
5
- #
6
- #
7
- # == *Transparent* *Nil*
8
- # Nil nervt oft. Zwar ist es ein schöner Fehlerindikator
9
- # (meist läuft irgendwas schief wenn man es unerwartet mit nil zu tun hat)
10
- # aber man verunstaltet seinen Quellcode schnell mit Fallunterscheidungen, die den nil-Fall behandeln.
11
- #
12
- # In Kyanite werden daher zahlreiche Methoden für nil definiert.
13
- # Nil verhält sich damit wie alle anderen Objekte auch.
14
- # Man kann immer noch nach Nil fragen, wenn man es möchte, aber man muss es nicht mehr tun!
15
- #
16
- class NilClass
17
-
18
- # Rückgabe: Array mit dem einen Element
19
- def <<(element); [element]; end
20
-
21
- # Rückgabe: true
22
- def empty?; true; end
23
-
24
- # Rückgabe: 0
25
- def length; 0; end
26
-
27
- # Rückgabe: 0
28
- def size; 0; end
29
-
30
- # Rückgabe: 0
31
- def count(*a); 0; end
32
-
33
- # Rückgabe: leeres Array
34
- def split(*a); []; end
35
-
36
- # Rückgabe: false
37
- def =~(other); false; end
38
-
39
- # Rückgabe: false
40
- # redundante Definition!
41
- def include?(*a); false; end
42
-
43
-
44
- def -(other); nil; end
45
- def +(other); nil; end
46
- def <(*a); nil; end
47
- def <=>(*a); nil; end
48
- def >(*a); nil; end
49
- def abs; nil; end
50
- def chop; nil; end
51
- def clear; nil; end
52
- def code; nil; end
53
- def collect(&block); nil; end
54
- def compact; nil; end
55
- def downcase; nil; end
56
- def dup; nil; end
57
- def each(*a); nil; end
58
- def grep(*a); nil; end
59
- def gsub!(*a); nil; end
60
- def gsub(*a); nil; end
61
- def join; nil; end
62
- def keys; nil; end
63
- def pop(*a); nil; end
64
- def push(*a); nil; end
65
- #def split(*a); nil; end
66
- def strip!(*a); nil; end
67
- def strip(*a); nil; end
68
- def sub(*a); nil; end
69
- def to_i; nil; end
70
- def to_integer; nil; end
71
- def to_nil; nil; end
72
- def to_sym; nil; end
73
- def uniq!; nil; end
74
- def uniq; nil; end
75
- def [](*a); nil; end
76
- def []=(*a); nil; end
77
-
78
-
79
- end
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
data/lib/kyanite/nil.rb DELETED
@@ -1,3 +0,0 @@
1
- # ruby encoding: utf-8
2
- require 'kyanite/general/nil'
3
-
data/script/console.rb DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/kyanite.rb'}"
9
- puts "Welcome to Kyanite gem"
10
- exec "#{irb} #{libs} --simple-prompt --noreadline"
@@ -1,48 +0,0 @@
1
- # ruby encoding: utf-8
2
- # ü
3
- if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
6
- end
7
-
8
- require 'kyanite/unit_test'
9
- require 'kyanite/general/nil'
10
-
11
- # Tests for NilClass
12
- class TestKyaniteNil < UnitTest
13
-
14
- def test_nil_patches
15
- assert nil.empty?
16
-
17
- assert ! nil.include?('g')
18
- assert ! nil.include?(nil)
19
-
20
- assert_nil nil.to_nil
21
- assert_equal 0, nil.size
22
- assert_equal 0, nil.length
23
-
24
- assert_equal nil, nil + 42
25
- assert_equal nil, nil + '42'
26
- assert_equal '', nil.to_s
27
-
28
- assert_nil nil[1]
29
- assert_nil nil[1,2]
30
- assert_nil nil[1][2]
31
- assert_nil nil[1][2,3][4]
32
- assert_nil nil[nil]
33
- assert_nil nil[nil,nil]
34
- assert_nil nil[nil][nil]
35
-
36
- assert_equal 42, nil[1] = 42
37
- assert_equal 42, nil[1,2] = 42
38
- assert_equal 42, nil[1][2] = 42
39
- assert_equal 42, nil[1][2,3][4] = 42
40
- assert_equal 42, nil[nil] = 42
41
- assert_equal 42, nil[nil,nil] = 42
42
- assert_equal 42, nil[nil][nil] = 42
43
-
44
- end # test_nil_patches
45
-
46
-
47
-
48
- end # class