ludy 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/CHANGES +26 -0
  2. data/Manifest.txt +28 -15
  3. data/NOTICE +9 -1
  4. data/README +7 -4
  5. data/Rakefile +11 -7
  6. data/lib/ludy.rb +3 -4
  7. data/lib/ludy/array/choice.rb +14 -0
  8. data/lib/ludy/array/combine.rb +1 -1
  9. data/lib/ludy/array/combos.rb +28 -19
  10. data/lib/ludy/array/count.rb +7 -0
  11. data/lib/ludy/array/head.rb +4 -0
  12. data/lib/ludy/array/pad.rb +13 -0
  13. data/lib/ludy/array/product.rb +14 -0
  14. data/lib/ludy/array/rotate.rb +3 -4
  15. data/lib/ludy/array/tail.rb +1 -0
  16. data/lib/ludy/hash.rb +3 -0
  17. data/lib/ludy/hash/reverse_merge.rb +11 -0
  18. data/lib/ludy/kernel/deep_copy.rb +6 -0
  19. data/lib/ludy/kernel/maybe.rb +6 -0
  20. data/lib/ludy/paginator.rb +1 -1
  21. data/lib/ludy/timer.rb +29 -0
  22. data/lib/puzzle_generator.rb +7 -5
  23. data/lib/puzzle_generator/chain.rb +5 -3
  24. data/lib/puzzle_generator/chained_map.rb +11 -11
  25. data/lib/puzzle_generator/map.rb +7 -7
  26. data/lib/puzzle_generator/misc.rb +7 -6
  27. data/lib/puzzle_generator/puzzle.rb +1 -4
  28. data/spec/ludy_spec.rb +8 -0
  29. data/spec/spec_helper.rb +17 -0
  30. data/tasks/doc.rake +1 -3
  31. data/tasks/gem.rake +2 -2
  32. data/tasks/manifest.rake +16 -2
  33. data/tasks/post_load.rake +18 -0
  34. data/tasks/setup.rb +47 -9
  35. data/tasks/spec.rake +3 -0
  36. data/test/example_puzzle.rb +7 -7
  37. data/test/helper.rb +3 -0
  38. data/test/{test_array.rb → ludy/test_array.rb} +12 -2
  39. data/test/{test_class.rb → ludy/test_class.rb} +1 -1
  40. data/test/{test_defun.rb → ludy/test_defun.rb} +1 -1
  41. data/test/{test_dices.rb → ludy/test_dices.rb} +1 -1
  42. data/test/ludy/test_hash.rb +13 -0
  43. data/test/{test_kernel.rb → ludy/test_kernel.rb} +1 -1
  44. data/test/{test_lazy.rb → ludy/test_lazy.rb} +1 -1
  45. data/test/{test_paginator.rb → ludy/test_paginator.rb} +2 -2
  46. data/test/{test_proc.rb → ludy/test_proc.rb} +2 -1
  47. data/test/{test_require_all.rb → ludy/test_require_all.rb} +1 -1
  48. data/test/{test_symbol.rb → ludy/test_symbol.rb} +1 -1
  49. data/test/{test_variable.rb → ludy/test_variable.rb} +1 -1
  50. data/test/{test_y_combinator.rb → ludy/test_y_combinator.rb} +1 -1
  51. data/test/{test_z_combinator.rb → ludy/test_z_combinator.rb} +1 -1
  52. data/test/multiruby.sh +2 -0
  53. metadata +54 -41
  54. data/lib/ludy/array/reverse_map.rb +0 -7
  55. data/lib/ludy/test/helper.rb +0 -3
@@ -0,0 +1,3 @@
1
+
2
+ require 'test/unit'
3
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy')
@@ -1,7 +1,7 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/array'
4
- require 'ludy/symbol/to_proc'
4
+ require 'ludy/symbol/to_proc' if RUBY_VERSION < '1.9.0'
5
5
 
6
6
  class TestArray < Test::Unit::TestCase
7
7
  def test_filter
@@ -49,5 +49,15 @@ class TestArray < Test::Unit::TestCase
49
49
  def test_tail
50
50
  assert_equal [2,3,4], [1,2,3,4].tail
51
51
  end
52
+ def test_pad
53
+ assert_equal [1,2,3,nil,nil], [1,2,3].pad(5)
54
+ assert_equal [1,2,3], [1,2,3].pad(3)
55
+ assert_equal [1,2,3], [1,2,3].pad(2)
56
+ assert_equal [1,2,3], [1,2,3].pad(-2)
57
+ assert_equal [1,2,3], [1,2,3].pad(0)
58
+ a = [1,2,3]
59
+ a.pad! 5, 6
60
+ assert_equal [1,2,3,6,6], a
61
+ end
52
62
  end
53
63
 
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/class/undef_all_methods'
4
4
 
5
5
  class TestClass < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/kernel/defun'
4
4
 
5
5
  class TestDefun < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/dices'
4
4
 
5
5
  class TestDices < Test::Unit::TestCase
@@ -0,0 +1,13 @@
1
+
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
+ require 'ludy/hash'
4
+
5
+ class TestClass < Test::Unit::TestCase
6
+ def test_reverse_merge
7
+ opt = {:a => 1, :b => 2}
8
+ assert_equal opt, opt.reverse_merge({:a => 3})
9
+ assert_equal opt, opt.reverse_merge!({:a => 3})
10
+ assert_equal opt.merge({:c => 3}), opt.reverse_merge({:c => 3})
11
+ end
12
+ end
13
+
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/kernel'
4
4
 
5
5
  class TestKernel < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/lazy'
4
4
 
5
5
  class TestLazy < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/paginator'
4
4
  require 'ludy/symbol/to_proc' if RUBY_VERSION < '1.9.0'
5
5
 
@@ -49,7 +49,7 @@ class TestPaginator < Test::Unit::TestCase
49
49
  end
50
50
  class Topic
51
51
  class << self
52
- def count
52
+ def count opts = {}
53
53
  101
54
54
  end
55
55
  def find all, opts = {}
@@ -1,6 +1,7 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/proc'
4
+ require 'ludy/symbol/to_proc' if RUBY_VERSION < '1.9.0'
4
5
 
5
6
  class TestProc < Test::Unit::TestCase
6
7
  def test_bind
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/all'
4
4
 
5
5
  class TestAll < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/symbol'
4
4
 
5
5
  class TestSymbol < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/variable'
4
4
 
5
5
  class TestVariable < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/y_combinator'
4
4
 
5
5
  include Ludy # why should this be here?
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'ludy/test/helper')
2
+ require File.join(File.dirname(__FILE__), '..', 'helper')
3
3
  require 'ludy/z_combinator'
4
4
 
5
5
  class TestZCombinator < Test::Unit::TestCase
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ multiruby -e 'require "rubygems"; require "rake"; Rake.application.run' test
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ludy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Lin Jen-Shin (a.k.a. godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
@@ -9,19 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-31 00:00:00 +08:00
12
+ date: 2008-02-07 00:00:00 +08:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rake
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
23
- version:
24
- description: "== DESCRIPTION:"
14
+ dependencies: []
15
+
16
+ description: Aims to extend Ruby standard library, providing some useful tools that's not existed in the standard library, especially for functional programming.
25
17
  email: "strip any number: 18god29fat7029 (at] godfat32 -dooot- 20org"
26
18
  executables:
27
19
  - ludy
@@ -38,10 +30,12 @@ extra_rdoc_files:
38
30
  - tasks/doc.rake
39
31
  - tasks/gem.rake
40
32
  - tasks/manifest.rake
33
+ - tasks/post_load.rake
41
34
  - tasks/rubyforge.rake
42
35
  - tasks/spec.rake
43
36
  - tasks/svn.rake
44
37
  - tasks/test.rake
38
+ - test/multiruby.sh
45
39
  files:
46
40
  - CHANGES
47
41
  - LICENSE
@@ -55,13 +49,17 @@ files:
55
49
  - lib/ludy/all.rb
56
50
  - lib/ludy/array.rb
57
51
  - lib/ludy/array/body.rb
52
+ - lib/ludy/array/choice.rb
58
53
  - lib/ludy/array/combine.rb
59
54
  - lib/ludy/array/combos.rb
55
+ - lib/ludy/array/count.rb
60
56
  - lib/ludy/array/filter.rb
61
57
  - lib/ludy/array/foldl.rb
62
58
  - lib/ludy/array/foldr.rb
59
+ - lib/ludy/array/head.rb
63
60
  - lib/ludy/array/map_with_index.rb
64
- - lib/ludy/array/reverse_map.rb
61
+ - lib/ludy/array/pad.rb
62
+ - lib/ludy/array/product.rb
65
63
  - lib/ludy/array/rotate.rb
66
64
  - lib/ludy/array/tail.rb
67
65
  - lib/ludy/blackhole.rb
@@ -75,13 +73,17 @@ files:
75
73
  - lib/ludy/deprecated/untranspose.rb
76
74
  - lib/ludy/deprecated/unzip.rb
77
75
  - lib/ludy/dices.rb
76
+ - lib/ludy/hash.rb
77
+ - lib/ludy/hash/reverse_merge.rb
78
78
  - lib/ludy/helpers/check_box.rb
79
79
  - lib/ludy/kernel.rb
80
+ - lib/ludy/kernel/deep_copy.rb
80
81
  - lib/ludy/kernel/defun.rb
81
82
  - lib/ludy/kernel/ergo.rb
82
83
  - lib/ludy/kernel/id.rb
83
84
  - lib/ludy/kernel/if_else.rb
84
85
  - lib/ludy/kernel/m.rb
86
+ - lib/ludy/kernel/maybe.rb
85
87
  - lib/ludy/kernel/public_send.rb
86
88
  - lib/ludy/kernel/singleton_method.rb
87
89
  - lib/ludy/kernel/tap.rb
@@ -106,7 +108,7 @@ files:
106
108
  - lib/ludy/tasks/preprocess_cpp/debug_hook.rb
107
109
  - lib/ludy/tasks/preprocess_cpp/header_guard.rb
108
110
  - lib/ludy/tasks/preprocess_cpp/template_forward_parameters.rb
109
- - lib/ludy/test/helper.rb
111
+ - lib/ludy/timer.rb
110
112
  - lib/ludy/variable.rb
111
113
  - lib/ludy/y_combinator.rb
112
114
  - lib/ludy/z_combinator.rb
@@ -118,10 +120,12 @@ files:
118
120
  - lib/puzzle_generator/misc.rb
119
121
  - lib/puzzle_generator/puzzle.rb
120
122
  - spec/ludy_spec.rb
123
+ - spec/spec_helper.rb
121
124
  - tasks/annotations.rake
122
125
  - tasks/doc.rake
123
126
  - tasks/gem.rake
124
127
  - tasks/manifest.rake
128
+ - tasks/post_load.rake
125
129
  - tasks/rubyforge.rake
126
130
  - tasks/setup.rb
127
131
  - tasks/spec.rake
@@ -134,23 +138,31 @@ files:
134
138
  - test/deprecated/ts_ludy.rb
135
139
  - test/deprecated/unzip_and_untranspose.rb
136
140
  - test/example_puzzle.rb
137
- - test/test_array.rb
138
- - test/test_class.rb
139
- - test/test_defun.rb
140
- - test/test_dices.rb
141
- - test/test_kernel.rb
142
- - test/test_lazy.rb
143
- - test/test_paginator.rb
144
- - test/test_proc.rb
145
- - test/test_require_all.rb
146
- - test/test_symbol.rb
147
- - test/test_variable.rb
148
- - test/test_y_combinator.rb
149
- - test/test_z_combinator.rb
141
+ - test/helper.rb
142
+ - test/ludy/test_array.rb
143
+ - test/ludy/test_class.rb
144
+ - test/ludy/test_defun.rb
145
+ - test/ludy/test_dices.rb
146
+ - test/ludy/test_hash.rb
147
+ - test/ludy/test_kernel.rb
148
+ - test/ludy/test_lazy.rb
149
+ - test/ludy/test_paginator.rb
150
+ - test/ludy/test_proc.rb
151
+ - test/ludy/test_require_all.rb
152
+ - test/ludy/test_symbol.rb
153
+ - test/ludy/test_variable.rb
154
+ - test/ludy/test_y_combinator.rb
155
+ - test/ludy/test_z_combinator.rb
156
+ - test/multiruby.sh
150
157
  has_rdoc: true
151
158
  homepage: http://ludy.rubyforge.org/
152
159
  post_install_message:
153
160
  rdoc_options:
161
+ - --diagram
162
+ - --charset=utf-8
163
+ - --inline-source
164
+ - --line-numbers
165
+ - --promiscuous
154
166
  - --main
155
167
  - README
156
168
  require_paths:
@@ -175,16 +187,17 @@ signing_key:
175
187
  specification_version: 2
176
188
  summary: Aims to extend Ruby standard library, providing some useful tools that's not existed in the standard library, especially for functional programming.
177
189
  test_files:
178
- - test/test_array.rb
179
- - test/test_class.rb
180
- - test/test_defun.rb
181
- - test/test_dices.rb
182
- - test/test_kernel.rb
183
- - test/test_lazy.rb
184
- - test/test_paginator.rb
185
- - test/test_proc.rb
186
- - test/test_require_all.rb
187
- - test/test_symbol.rb
188
- - test/test_variable.rb
189
- - test/test_y_combinator.rb
190
- - test/test_z_combinator.rb
190
+ - test/ludy/test_array.rb
191
+ - test/ludy/test_class.rb
192
+ - test/ludy/test_defun.rb
193
+ - test/ludy/test_dices.rb
194
+ - test/ludy/test_hash.rb
195
+ - test/ludy/test_kernel.rb
196
+ - test/ludy/test_lazy.rb
197
+ - test/ludy/test_paginator.rb
198
+ - test/ludy/test_proc.rb
199
+ - test/ludy/test_require_all.rb
200
+ - test/ludy/test_symbol.rb
201
+ - test/ludy/test_variable.rb
202
+ - test/ludy/test_y_combinator.rb
203
+ - test/ludy/test_z_combinator.rb
@@ -1,7 +0,0 @@
1
-
2
- class Array
3
- # synonymy for reverse.map
4
- def reverse_map &block
5
- reverse.map(&block)
6
- end
7
- end
@@ -1,3 +0,0 @@
1
-
2
- require 'test/unit'
3
- require File.join(File.dirname(__FILE__), '..', '..', 'ludy')