prelude 0.0.3 → 0.0.5

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 (43) hide show
  1. data/CHANGELOG +25 -1
  2. data/README +11 -12
  3. data/Rakefile +6 -10
  4. data/lib/prelude.rb +36 -91
  5. data/lib/prelude/{tuple.rb → array_list.rb} +30 -27
  6. data/lib/prelude/functions.rb +414 -0
  7. data/lib/prelude/functors.rb +72 -0
  8. data/lib/prelude/lambda.rb +89 -0
  9. data/lib/prelude/minimal_array_list.rb +61 -0
  10. data/lib/prelude/monad.rb +11 -15
  11. data/lib/prelude/proper_list.rb +47 -0
  12. data/lib/prelude/proper_ruby_list.rb +48 -0
  13. data/lib/prelude/util.rb +33 -0
  14. data/test/tc_functions.rb +801 -0
  15. data/test/tc_monad.rb +21 -41
  16. data/test/ts_prelude.rb +2 -8
  17. metadata +13 -36
  18. data/doc/classes/Kernel.html +0 -198
  19. data/doc/classes/Prelude.html +0 -241
  20. data/doc/classes/Prelude/EmptyListError.html +0 -113
  21. data/doc/classes/Prelude/List.html +0 -2692
  22. data/doc/classes/Prelude/MissingFunctionError.html +0 -113
  23. data/doc/classes/Prelude/Monad.html +0 -283
  24. data/doc/classes/Prelude/Tuple.html +0 -217
  25. data/doc/classes/Proc.html +0 -198
  26. data/doc/classes/Symbol.html +0 -219
  27. data/doc/created.rid +0 -1
  28. data/doc/files/CHANGELOG.html +0 -122
  29. data/doc/files/README.html +0 -328
  30. data/doc/files/TODO.html +0 -95
  31. data/doc/files/lib/prelude/list_rb.html +0 -83
  32. data/doc/files/lib/prelude/monad_rb.html +0 -83
  33. data/doc/files/lib/prelude/tuple_rb.html +0 -83
  34. data/doc/files/lib/prelude_rb.html +0 -98
  35. data/doc/fr_class_index.html +0 -35
  36. data/doc/fr_file_index.html +0 -33
  37. data/doc/fr_method_index.html +0 -140
  38. data/doc/index.html +0 -27
  39. data/doc/rdoc-style.css +0 -208
  40. data/lib/prelude/list.rb +0 -588
  41. data/test/tc_higher.rb +0 -89
  42. data/test/tc_list.rb +0 -777
  43. data/test/tc_tuple.rb +0 -82
@@ -1,5 +1,5 @@
1
1
  #--
2
- # $Id: tc_monad.rb 13 2006-09-11 05:19:16Z prelude $
2
+ # $Id: tc_monad.rb 31 2006-12-28 02:28:28Z prelude $
3
3
  #
4
4
  #
5
5
  # This file is part of the Prelude library that provides tools to
@@ -24,9 +24,12 @@
24
24
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
25
  #++
26
26
 
27
+ require 'prelude'
28
+
27
29
  # A test class representing a genesis of a possible cloned animal
28
30
  class Cloned
29
- include Monad
31
+
32
+ include Prelude::Monad
30
33
 
31
34
  attr_reader :name, :mother, :father
32
35
 
@@ -51,7 +54,7 @@ class Cloned
51
54
 
52
55
  # Monadic versions
53
56
  def m_maternalGrandfather
54
- wrap << :mother << :father << unwrap
57
+ wrap >> :mother >> :father >> unwrap
55
58
  end
56
59
 
57
60
  def m_mothersPaternalGrandfather
@@ -93,53 +96,30 @@ class TestMonad < Test::Unit::TestCase
93
96
  assert_equal(expect, result)
94
97
  end
95
98
 
96
- def test_bind1
97
- result = @sheep.m_maternalGrandfather
99
+ def test_bind
100
+ # Wrap and >>
101
+ result = @sheep.wrap >> :mother >> :father >> @sheep.unwrap
98
102
  expect = @grandpa
99
103
 
100
104
  assert_equal(expect, result)
101
- end
102
105
 
103
- def test_bind2
104
- result = @sheep.m_mothersPaternalGrandfather
106
+ # Wrap and bind
107
+ result = @sheep.wrap.bind(:mother).bind(:father).bind(:father).unwrap
105
108
  expect = nil
106
109
 
107
110
  assert_equal(expect, result)
108
- end
109
111
 
110
- def aaa(one, two=222, *args, &block)
111
- puts 'aaa: '
112
- puts 'one=' + one.inspect
113
- puts 'two=' + two.inspect
114
- args.each{|x| puts 'p= '+x.inspect}
115
- puts 'b= '+block.inspect
116
- bbb
117
- end
112
+ # Auto-wrap and >>
113
+ result = @sheep >> :mother >> :father >> @sheep.unwrap
114
+ expect = @grandpa
115
+
116
+ assert_equal(expect, result)
118
117
 
119
- def bbb
120
- puts 'AAA: '+caller_method.inspect
121
- puts 'Arity: '+caller_method.to_proc.arity.inspect
118
+ # Auto-wrap and bind
119
+ result = @sheep.bind(:mother).bind(:father).bind(:father).unwrap
120
+ expect = nil
121
+
122
+ assert_equal(expect, result)
122
123
  end
123
124
 
124
- # def test_method
125
- # p = proc {}
126
- # # aaa()
127
- # aaa(1)
128
- # aaa(1, "aaa")
129
- # # aaa(){|x| x+1}
130
- # aaa(1){|x| x+1}
131
- # aaa(1, 2, 3){|x| x+1}
132
- # aaa(1, 2, :aaa, 3){|x| x+1}
133
- # aaa(1, proc {|x| x+1}, :aaa, 3){|x| x+1}
134
- # aaa(proc {|x| x+1})
135
- # aaa([1, 2, 3])
136
- # aaa([1, 2, 3])
137
- # aaa(*[1, 2, 3, p])
138
- # aaa(*[1, 2, 3, p], &p)
139
- # end
140
-
141
- # def test_misc
142
- # puts "this: "+ this_method.inspect
143
- # puts "caller: "+caller_method.inspect
144
- # end
145
125
  end # TestMonad
@@ -1,5 +1,5 @@
1
1
  #--
2
- # $Id: ts_prelude.rb 12 2006-09-07 20:50:50Z prelude $
2
+ # $Id: ts_prelude.rb 28 2006-12-19 00:12:54Z prelude $
3
3
  #
4
4
  #
5
5
  # This file is part of the Prelude library that provides tools to
@@ -26,11 +26,5 @@
26
26
 
27
27
  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
28
28
 
29
- require 'prelude'
30
- include Prelude
31
- require 'test/unit'
32
-
33
- require 'tc_list'
34
- require 'tc_higher'
35
- require 'tc_tuple'
29
+ require 'tc_functions'
36
30
  require 'tc_monad'
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: prelude
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.3
7
- date: 2006-09-17 00:00:00 -05:00
6
+ version: 0.0.5
7
+ date: 2007-10-23 00:00:00 -05:00
8
8
  summary: Haskell-like functional library
9
9
  require_paths:
10
10
  - lib
@@ -34,42 +34,19 @@ files:
34
34
  - TODO
35
35
  - CHANGELOG
36
36
  - COPYING
37
- - doc/classes
38
- - doc/created.rid
39
- - doc/files
40
- - doc/fr_class_index.html
41
- - doc/fr_file_index.html
42
- - doc/fr_method_index.html
43
- - doc/index.html
44
- - doc/rdoc-style.css
45
- - doc/classes/Kernel.html
46
- - doc/classes/Prelude
47
- - doc/classes/Prelude.html
48
- - doc/classes/Proc.html
49
- - doc/classes/Symbol.html
50
- - doc/classes/Prelude/EmptyListError.html
51
- - doc/classes/Prelude/List.html
52
- - doc/classes/Prelude/MissingFunctionError.html
53
- - doc/classes/Prelude/Monad.html
54
- - doc/classes/Prelude/Tuple.html
55
- - doc/files/CHANGELOG.html
56
- - doc/files/lib
57
- - doc/files/README.html
58
- - doc/files/TODO.html
59
- - doc/files/lib/prelude
60
- - doc/files/lib/prelude_rb.html
61
- - doc/files/lib/prelude/list_rb.html
62
- - doc/files/lib/prelude/monad_rb.html
63
- - doc/files/lib/prelude/tuple_rb.html
64
37
  - lib/prelude
65
- - lib/prelude.rb
66
- - lib/prelude/list.rb
38
+ - lib/prelude/array_list.rb
39
+ - lib/prelude/functions.rb
40
+ - lib/prelude/functors.rb
41
+ - lib/prelude/lambda.rb
42
+ - lib/prelude/minimal_array_list.rb
67
43
  - lib/prelude/monad.rb
68
- - lib/prelude/tuple.rb
69
- - test/tc_higher.rb
70
- - test/tc_list.rb
44
+ - lib/prelude/proper_list.rb
45
+ - lib/prelude/proper_ruby_list.rb
46
+ - lib/prelude/util.rb
47
+ - lib/prelude.rb
48
+ - test/tc_functions.rb
71
49
  - test/tc_monad.rb
72
- - test/tc_tuple.rb
73
50
  - test/ts_prelude.rb
74
51
  test_files:
75
52
  - test/ts_prelude.rb
@@ -1,198 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: Kernel</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">Kernel</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/prelude_rb.html">
59
- lib/prelude.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
-
76
-
77
- </div>
78
-
79
- <div id="method-list">
80
- <h3 class="section-bar">Methods</h3>
81
-
82
- <div class="name-list">
83
- <a href="#M000113">caller_method</a>&nbsp;&nbsp;
84
- <a href="#M000114">silence_warnings</a>&nbsp;&nbsp;
85
- <a href="#M000112">this_method</a>&nbsp;&nbsp;
86
- </div>
87
- </div>
88
-
89
- </div>
90
-
91
-
92
- <!-- if includes -->
93
-
94
- <div id="section">
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
- <!-- if method_list -->
104
- <div id="methods">
105
- <h3 class="section-bar">Public Instance methods</h3>
106
-
107
- <div id="method-M000113" class="method-detail">
108
- <a name="M000113"></a>
109
-
110
- <div class="method-heading">
111
- <a href="#M000113" class="method-signature">
112
- <span class="method-name">caller_method</span><span class="method-args">()</span>
113
- </a>
114
- </div>
115
-
116
- <div class="method-description">
117
- <p>
118
- Method object for the caller of the currently executing method
119
- </p>
120
- <p><a class="source-toggle" href="#"
121
- onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
122
- <div class="method-source-code" id="M000113-source">
123
- <pre>
124
- <span class="ruby-comment cmt"># File lib/prelude.rb, line 118</span>
125
- 118: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">caller_method</span>
126
- 119: <span class="ruby-identifier">name</span> = (<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">caller</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`([^']*)'/</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">$1</span>)
127
- 120: <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;self.method(\&quot;#{name}\&quot;.to_sym)&quot;</span>, <span class="ruby-identifier">binding</span>
128
- 121: <span class="ruby-keyword kw">end</span>
129
- </pre>
130
- </div>
131
- </div>
132
- </div>
133
-
134
- <div id="method-M000114" class="method-detail">
135
- <a name="M000114"></a>
136
-
137
- <div class="method-heading">
138
- <a href="#M000114" class="method-signature">
139
- <span class="method-name">silence_warnings</span><span class="method-args">() {|| ...}</span>
140
- </a>
141
- </div>
142
-
143
- <div class="method-description">
144
- <p>
145
- Shuts up Ruby&#8217;s warning.
146
- </p>
147
- <p><a class="source-toggle" href="#"
148
- onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
149
- <div class="method-source-code" id="M000114-source">
150
- <pre>
151
- <span class="ruby-comment cmt"># File lib/prelude.rb, line 124</span>
152
- 124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">silence_warnings</span>
153
- 125: <span class="ruby-identifier">old_verbose</span>, <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">$VERBOSE</span>, <span class="ruby-keyword kw">nil</span>
154
- 126: <span class="ruby-keyword kw">yield</span>
155
- 127: <span class="ruby-keyword kw">ensure</span>
156
- 128: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">old_verbose</span>
157
- 129: <span class="ruby-keyword kw">end</span>
158
- </pre>
159
- </div>
160
- </div>
161
- </div>
162
-
163
- <div id="method-M000112" class="method-detail">
164
- <a name="M000112"></a>
165
-
166
- <div class="method-heading">
167
- <a href="#M000112" class="method-signature">
168
- <span class="method-name">this_method</span><span class="method-args">()</span>
169
- </a>
170
- </div>
171
-
172
- <div class="method-description">
173
- <p>
174
- Method object for currently executing method
175
- </p>
176
- <p><a class="source-toggle" href="#"
177
- onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
178
- <div class="method-source-code" id="M000112-source">
179
- <pre>
180
- <span class="ruby-comment cmt"># File lib/prelude.rb, line 112</span>
181
- 112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">this_method</span>
182
- 113: <span class="ruby-identifier">name</span> = (<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">caller</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`([^']*)'/</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">$1</span>)
183
- 114: <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;self.method(\&quot;#{name}\&quot;.to_sym)&quot;</span>, <span class="ruby-identifier">binding</span>
184
- 115: <span class="ruby-keyword kw">end</span>
185
- </pre>
186
- </div>
187
- </div>
188
- </div>
189
-
190
-
191
- </div>
192
-
193
-
194
- </div>
195
-
196
-
197
- </body>
198
- </html>
@@ -1,241 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: Prelude</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">Prelude</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/prelude_rb.html">
59
- lib/prelude.rb
60
- </a>
61
- <br />
62
- <a href="../files/lib/prelude/list_rb.html">
63
- lib/prelude/list.rb
64
- </a>
65
- <br />
66
- <a href="../files/lib/prelude/monad_rb.html">
67
- lib/prelude/monad.rb
68
- </a>
69
- <br />
70
- <a href="../files/lib/prelude/tuple_rb.html">
71
- lib/prelude/tuple.rb
72
- </a>
73
- <br />
74
- </td>
75
- </tr>
76
-
77
- </table>
78
- </div>
79
- <!-- banner header -->
80
-
81
- <div id="bodyContent">
82
-
83
-
84
-
85
- <div id="contextContent">
86
-
87
-
88
-
89
- </div>
90
-
91
- <div id="method-list">
92
- <h3 class="section-bar">Methods</h3>
93
-
94
- <div class="name-list">
95
- <a href="#M000007">empty_list_error</a>&nbsp;&nbsp;
96
- <a href="#M000009">get_proc</a>&nbsp;&nbsp;
97
- <a href="#M000008">missing_function_error</a>&nbsp;&nbsp;
98
- </div>
99
- </div>
100
-
101
- </div>
102
-
103
-
104
- <!-- if includes -->
105
-
106
- <div id="section">
107
-
108
- <div id="class-list">
109
- <h3 class="section-bar">Classes and Modules</h3>
110
-
111
- Module <a href="Prelude/List.html" class="link">Prelude::List</a><br />
112
- Module <a href="Prelude/Monad.html" class="link">Prelude::Monad</a><br />
113
- Class <a href="Prelude/EmptyListError.html" class="link">Prelude::EmptyListError</a><br />
114
- Class <a href="Prelude/MissingFunctionError.html" class="link">Prelude::MissingFunctionError</a><br />
115
- Class <a href="Prelude/Tuple.html" class="link">Prelude::Tuple</a><br />
116
-
117
- </div>
118
-
119
- <div id="constants-list">
120
- <h3 class="section-bar">Constants</h3>
121
-
122
- <div class="name-list">
123
- <table summary="Constants">
124
- <tr class="top-aligned-row context-row">
125
- <td class="context-item-name">VERSION</td>
126
- <td>=</td>
127
- <td class="context-item-value">'0.0.3'</td>
128
- </tr>
129
- <tr class="top-aligned-row context-row">
130
- <td class="context-item-name">Id</td>
131
- <td>=</td>
132
- <td class="context-item-value">lambda { |x| x }</td>
133
- <td width="3em">&nbsp;</td>
134
- <td class="context-item-desc">
135
- Returns function that returns its argument
136
-
137
- </td>
138
- </tr>
139
- </table>
140
- </div>
141
- </div>
142
-
143
-
144
-
145
-
146
-
147
-
148
- <!-- if method_list -->
149
- <div id="methods">
150
- <h3 class="section-bar">Public Instance methods</h3>
151
-
152
- <div id="method-M000007" class="method-detail">
153
- <a name="M000007"></a>
154
-
155
- <div class="method-heading">
156
- <a href="#M000007" class="method-signature">
157
- <span class="method-name">empty_list_error</span><span class="method-args">()</span>
158
- </a>
159
- </div>
160
-
161
- <div class="method-description">
162
- <p>
163
- This is used to handle empty list errors in this library. Re-define to fit.
164
- </p>
165
- <p><a class="source-toggle" href="#"
166
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
167
- <div class="method-source-code" id="M000007-source">
168
- <pre>
169
- <span class="ruby-comment cmt"># File lib/prelude.rb, line 39</span>
170
- 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty_list_error</span>
171
- 40: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EmptyListError</span>, <span class="ruby-value str">'Illegal operation on an empty list.'</span>
172
- 41: <span class="ruby-keyword kw">end</span>
173
- </pre>
174
- </div>
175
- </div>
176
- </div>
177
-
178
- <div id="method-M000009" class="method-detail">
179
- <a name="M000009"></a>
180
-
181
- <div class="method-heading">
182
- <a href="#M000009" class="method-signature">
183
- <span class="method-name">get_proc</span><span class="method-args">(f=nil, &amp;block)</span>
184
- </a>
185
- </div>
186
-
187
- <div class="method-description">
188
- <p>
189
- A utility to determine if a function was passed
190
- </p>
191
- <p><a class="source-toggle" href="#"
192
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
193
- <div class="method-source-code" id="M000009-source">
194
- <pre>
195
- <span class="ruby-comment cmt"># File lib/prelude.rb, line 52</span>
196
- 52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_proc</span>(<span class="ruby-identifier">f</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
197
- 53: <span class="ruby-comment cmt"># Has to be either function 'f' or block</span>
198
- 54: <span class="ruby-identifier">f</span> = <span class="ruby-identifier">block_given?</span> <span class="ruby-value">? </span><span class="ruby-identifier">block</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">missing_function_error</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">nil?</span>
199
- 55: <span class="ruby-identifier">f</span>.<span class="ruby-identifier">to_proc</span>
200
- 56: <span class="ruby-keyword kw">end</span>
201
- </pre>
202
- </div>
203
- </div>
204
- </div>
205
-
206
- <div id="method-M000008" class="method-detail">
207
- <a name="M000008"></a>
208
-
209
- <div class="method-heading">
210
- <a href="#M000008" class="method-signature">
211
- <span class="method-name">missing_function_error</span><span class="method-args">()</span>
212
- </a>
213
- </div>
214
-
215
- <div class="method-description">
216
- <p>
217
- This is used to handle missing function errors in this library. Re-define
218
- to fit.
219
- </p>
220
- <p><a class="source-toggle" href="#"
221
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
222
- <div class="method-source-code" id="M000008-source">
223
- <pre>
224
- <span class="ruby-comment cmt"># File lib/prelude.rb, line 47</span>
225
- 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">missing_function_error</span>
226
- 48: <span class="ruby-identifier">raise</span> <span class="ruby-constant">MissingFunctionError</span>, <span class="ruby-value str">'No function or block supplied.'</span>
227
- 49: <span class="ruby-keyword kw">end</span>
228
- </pre>
229
- </div>
230
- </div>
231
- </div>
232
-
233
-
234
- </div>
235
-
236
-
237
- </div>
238
-
239
-
240
- </body>
241
- </html>