hashery 1.5.0 → 2.0.0

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 (70) hide show
  1. data/.ruby +30 -17
  2. data/.yardopts +1 -0
  3. data/Config.rb +28 -0
  4. data/{QED.rdoc → DEMO.rdoc} +0 -0
  5. data/HISTORY.rdoc +37 -0
  6. data/LICENSE.txt +26 -0
  7. data/NOTICE.txt +46 -0
  8. data/README.rdoc +10 -7
  9. data/lib/hashery.rb +6 -6
  10. data/lib/hashery.yml +30 -17
  11. data/lib/hashery/association.rb +169 -109
  12. data/lib/hashery/casting_hash.rb +128 -135
  13. data/lib/hashery/core_ext.rb +89 -61
  14. data/lib/hashery/crud_hash.rb +365 -0
  15. data/lib/hashery/dictionary.rb +545 -345
  16. data/lib/hashery/fuzzy_hash.rb +177 -125
  17. data/lib/hashery/ini_hash.rb +321 -0
  18. data/lib/hashery/key_hash.rb +54 -179
  19. data/lib/hashery/linked_list.rb +245 -191
  20. data/lib/hashery/lru_hash.rb +292 -202
  21. data/lib/hashery/open_cascade.rb +133 -78
  22. data/lib/hashery/open_hash.rb +127 -61
  23. data/lib/hashery/ordered_hash.rb +128 -122
  24. data/lib/hashery/path_hash.rb +238 -0
  25. data/lib/hashery/property_hash.rb +144 -80
  26. data/lib/hashery/query_hash.rb +85 -29
  27. data/lib/hashery/stash.rb +7 -3
  28. data/lib/hashery/static_hash.rb +46 -41
  29. data/test/case_association.rb +65 -4
  30. data/test/case_dictionary.rb +149 -5
  31. data/test/{case_keyhash.rb → case_key_hash.rb} +20 -14
  32. data/test/case_lru_hash.rb +162 -0
  33. data/test/{case_opencascade.rb → case_open_cascade.rb} +4 -8
  34. data/test/case_open_hash.rb +87 -0
  35. data/test/case_query_hash.rb +226 -0
  36. data/test/helper.rb +8 -0
  37. metadata +33 -63
  38. data/COPYING.rdoc +0 -45
  39. data/lib/hashery/basic_object.rb +0 -74
  40. data/lib/hashery/basic_struct.rb +0 -288
  41. data/lib/hashery/basicobject.rb +0 -1
  42. data/lib/hashery/basicstruct.rb +0 -1
  43. data/lib/hashery/castinghash.rb +0 -1
  44. data/lib/hashery/fuzzyhash.rb +0 -1
  45. data/lib/hashery/ini.rb +0 -268
  46. data/lib/hashery/keyhash.rb +0 -1
  47. data/lib/hashery/linkedlist.rb +0 -1
  48. data/lib/hashery/lruhash.rb +0 -1
  49. data/lib/hashery/memoizer.rb +0 -64
  50. data/lib/hashery/open_object.rb +0 -1
  51. data/lib/hashery/opencascade.rb +0 -1
  52. data/lib/hashery/openhash.rb +0 -1
  53. data/lib/hashery/openobject.rb +0 -1
  54. data/lib/hashery/orderedhash.rb +0 -1
  55. data/lib/hashery/ostructable.rb +0 -186
  56. data/lib/hashery/propertyhash.rb +0 -1
  57. data/lib/hashery/queryhash.rb +0 -1
  58. data/lib/hashery/statichash.rb +0 -1
  59. data/qed/01_openhash.rdoc +0 -57
  60. data/qed/02_queryhash.rdoc +0 -21
  61. data/qed/03_castinghash.rdoc +0 -13
  62. data/qed/04_statichash.rdoc +0 -22
  63. data/qed/05_association.rdoc +0 -59
  64. data/qed/06_opencascade.rdoc +0 -58
  65. data/qed/07_fuzzyhash.rdoc +0 -141
  66. data/qed/08_properyhash.rdoc +0 -38
  67. data/qed/09_ostructable.rdoc +0 -56
  68. data/qed/applique/ae.rb +0 -1
  69. data/test/case_basicstruct.rb +0 -192
  70. data/test/case_openhash.rb +0 -22
@@ -0,0 +1,8 @@
1
+ require 'lemon'
2
+ require 'ae'
3
+ require 'ae/legacy' # bacause imitation BasicObject sucks
4
+ require 'ae/pry'
5
+
6
+ require 'hashery'
7
+
8
+ include Hashery
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,22 +15,11 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2011-11-11 00:00:00.000000000 Z
18
+ date: 2012-06-19 00:00:00.000000000 Z
19
19
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: blankslate
22
- requirement: &26633440 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ! '>='
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- type: :runtime
29
- prerelease: false
30
- version_requirements: *26633440
31
20
  - !ruby/object:Gem::Dependency
32
21
  name: detroit
33
- requirement: &26632080 !ruby/object:Gem::Requirement
22
+ requirement: &19204020 !ruby/object:Gem::Requirement
34
23
  none: false
35
24
  requirements:
36
25
  - - ! '>='
@@ -38,10 +27,10 @@ dependencies:
38
27
  version: '0'
39
28
  type: :development
40
29
  prerelease: false
41
- version_requirements: *26632080
30
+ version_requirements: *19204020
42
31
  - !ruby/object:Gem::Dependency
43
32
  name: qed
44
- requirement: &26631260 !ruby/object:Gem::Requirement
33
+ requirement: &19203280 !ruby/object:Gem::Requirement
45
34
  none: false
46
35
  requirements:
47
36
  - - ! '>='
@@ -49,10 +38,10 @@ dependencies:
49
38
  version: '0'
50
39
  type: :development
51
40
  prerelease: false
52
- version_requirements: *26631260
41
+ version_requirements: *19203280
53
42
  - !ruby/object:Gem::Dependency
54
43
  name: lemon
55
- requirement: &26630620 !ruby/object:Gem::Requirement
44
+ requirement: &19222540 !ruby/object:Gem::Requirement
56
45
  none: false
57
46
  requirements:
58
47
  - - ! '>='
@@ -60,84 +49,64 @@ dependencies:
60
49
  version: '0'
61
50
  type: :development
62
51
  prerelease: false
63
- version_requirements: *26630620
64
- description: ! 'The Hashery is a collection of Hash-like classes, spun-off from the
65
- original
52
+ version_requirements: *19222540
53
+ description: ! 'The Hashery is a tight collection of Hash-like classes. Included among
54
+ its many
55
+
56
+ offerings are the auto-sorting Dictionary class, the efficient LRUHash, the
66
57
 
67
- Ruby Facets library. Included are the widely used OrderedHash, the related but
58
+ flexible OpenHash and the convenient KeyHash. Nearly every class is a subclass
68
59
 
69
- more featured Dictionary class, a number of open classes, similiar to the
60
+ of the CRUDHash which defines a CRUD model on top of Ruby''s standard Hash
70
61
 
71
- standard OpenStruct and a few variations on the standard Hash.'
62
+ making it a snap to subclass and augment to fit any specific use case.'
72
63
  email:
73
64
  - transfire@gmail.com
74
65
  executables: []
75
66
  extensions: []
76
67
  extra_rdoc_files:
68
+ - LICENSE.txt
69
+ - NOTICE.txt
77
70
  - HISTORY.rdoc
71
+ - DEMO.rdoc
78
72
  - README.rdoc
79
- - QED.rdoc
80
- - COPYING.rdoc
81
73
  files:
82
74
  - .ruby
83
75
  - .yardopts
84
76
  - lib/hashery/association.rb
85
- - lib/hashery/basic_object.rb
86
- - lib/hashery/basic_struct.rb
87
- - lib/hashery/basicobject.rb
88
- - lib/hashery/basicstruct.rb
89
77
  - lib/hashery/casting_hash.rb
90
- - lib/hashery/castinghash.rb
91
78
  - lib/hashery/core_ext.rb
79
+ - lib/hashery/crud_hash.rb
92
80
  - lib/hashery/dictionary.rb
93
81
  - lib/hashery/fuzzy_hash.rb
94
- - lib/hashery/fuzzyhash.rb
95
- - lib/hashery/ini.rb
82
+ - lib/hashery/ini_hash.rb
96
83
  - lib/hashery/key_hash.rb
97
- - lib/hashery/keyhash.rb
98
84
  - lib/hashery/linked_list.rb
99
- - lib/hashery/linkedlist.rb
100
85
  - lib/hashery/lru_hash.rb
101
- - lib/hashery/lruhash.rb
102
- - lib/hashery/memoizer.rb
103
86
  - lib/hashery/open_cascade.rb
104
87
  - lib/hashery/open_hash.rb
105
- - lib/hashery/open_object.rb
106
- - lib/hashery/opencascade.rb
107
- - lib/hashery/openhash.rb
108
- - lib/hashery/openobject.rb
109
88
  - lib/hashery/ordered_hash.rb
110
- - lib/hashery/orderedhash.rb
111
- - lib/hashery/ostructable.rb
89
+ - lib/hashery/path_hash.rb
112
90
  - lib/hashery/property_hash.rb
113
- - lib/hashery/propertyhash.rb
114
91
  - lib/hashery/query_hash.rb
115
- - lib/hashery/queryhash.rb
116
92
  - lib/hashery/stash.rb
117
93
  - lib/hashery/static_hash.rb
118
- - lib/hashery/statichash.rb
119
94
  - lib/hashery.rb
120
95
  - lib/hashery.yml
121
- - qed/01_openhash.rdoc
122
- - qed/02_queryhash.rdoc
123
- - qed/03_castinghash.rdoc
124
- - qed/04_statichash.rdoc
125
- - qed/05_association.rdoc
126
- - qed/06_opencascade.rdoc
127
- - qed/07_fuzzyhash.rdoc
128
- - qed/08_properyhash.rdoc
129
- - qed/09_ostructable.rdoc
130
- - qed/applique/ae.rb
131
96
  - test/case_association.rb
132
- - test/case_basicstruct.rb
133
97
  - test/case_dictionary.rb
134
- - test/case_keyhash.rb
135
- - test/case_opencascade.rb
136
- - test/case_openhash.rb
98
+ - test/case_key_hash.rb
99
+ - test/case_lru_hash.rb
100
+ - test/case_open_cascade.rb
101
+ - test/case_open_hash.rb
102
+ - test/case_query_hash.rb
103
+ - test/helper.rb
137
104
  - HISTORY.rdoc
105
+ - DEMO.rdoc
106
+ - LICENSE.txt
138
107
  - README.rdoc
139
- - QED.rdoc
140
- - COPYING.rdoc
108
+ - NOTICE.txt
109
+ - Config.rb
141
110
  homepage: http://rubyworks.github.com/hashery
142
111
  licenses:
143
112
  - BSD-2-Clause
@@ -145,6 +114,7 @@ post_install_message:
145
114
  rdoc_options: []
146
115
  require_paths:
147
116
  - lib
117
+ - alt
148
118
  required_ruby_version: !ruby/object:Gem::Requirement
149
119
  none: false
150
120
  requirements:
@@ -159,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
129
  version: '0'
160
130
  requirements: []
161
131
  rubyforge_project:
162
- rubygems_version: 1.8.10
132
+ rubygems_version: 1.8.11
163
133
  signing_key:
164
134
  specification_version: 3
165
135
  summary: Facets-bread collection of Hash-like classes.
@@ -1,45 +0,0 @@
1
- = COPYRIGHT NOTICES
2
-
3
- == Hashery
4
-
5
- Copyright:: (c) 2009 Thomas Sawyer, Rubyworks
6
- License:: BSD-2-Clause
7
- Website:: http://rubyworks.github.com/hashery
8
-
9
- Copyright (c) 2009 Thomas Sawyer, Rubyworks
10
-
11
- Redistribution and use in source and binary forms, with or without modification, are
12
- permitted provided that the following conditions are met:
13
-
14
- 1. Redistributions of source code must retain the above copyright notice, this list of
15
- conditions and the following disclaimer.
16
-
17
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
18
- of conditions and the following disclaimer in the documentation and/or other materials
19
- provided with the distribution.
20
-
21
- THIS SOFTWARE IS PROVIDED BY Thomas Sawyer ``AS IS'' AND ANY EXPRESS OR IMPLIED
22
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Thomas Sawyer OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- The views and conclusions contained in the software and documentation are those of the
32
- authors and should not be interpreted as representing official policies, either expressed
33
- or implied, of Thomas Sawyer.
34
-
35
- == BasicObject
36
-
37
- Copyright:: (c) 2004 Jim Weirich
38
- Website:: http://rake.rubyforge.org
39
-
40
- BasicObject class is a variation of Jim Weirich's BlankSlate class.
41
-
42
- BlankSlate
43
- Copyright 2004 by Jim Weirich (jim@weirichhouse.org).
44
- All rights reserved.
45
-
@@ -1,74 +0,0 @@
1
- # Facets' BasicObject is an implementation of Jim Weirich's BlankSlate.
2
- #
3
- # BlankSlate
4
- # Copyright 2004 by Jim Weirich (jim@weirichhouse.org).
5
- # All rights reserved.
6
- #
7
- # Since Ruby 1.9 has a BasicObject class this will of course be
8
- # deprecated as 1.9 goes mainstream.
9
-
10
- unless defined? BasicObject # in case it already exists!
11
-
12
- # BasicObject provides an abstract base class with no predefined
13
- # methods (except for <tt>\_\_send__</tt> and <tt>\_\_id__</tt>).
14
- # BlankSlate is useful as a base class when writing classes that
15
- # depend upon <tt>method_missing</tt> (e.g. dynamic proxies).
16
- class BasicObject
17
- class << self
18
- # Hide the method named +name+ in the BlankSlate class. Don't
19
- # hide +instance_eval+ or any method beginning with "__".
20
- #
21
- # According to 1.9.1 it should have only these methods:
22
- #
23
- # * #__send__
24
- # * #instance_eval
25
- # * #instance_exec
26
- # * #equal?
27
- # * #==
28
- # * #!
29
- # * #!=
30
- # * respond_to?
31
- #
32
- # Seems to me it should have #__id__ too.
33
- def hide(name)
34
- undef_method name if
35
- instance_methods.include?(name.to_s) and
36
- name !~ /^(__|respond_to\?|instance_eval$|instance_exec$|equal\?$|\=\=$)/
37
- end
38
- end
39
- instance_methods.each{ |m| hide(m) }
40
- end
41
-
42
- # Since Ruby is very dynamic, methods added to the ancestors of
43
- # BlankSlate <em>after BlankSlate is defined</em> will show up in the
44
- # list of available BlankSlate methods. We handle this by defining a
45
- # hook in the Object and Kernel classes that will hide any defined
46
- module Kernel #:nodoc:
47
- class << self
48
- alias_method :basic_object_method_added, :method_added
49
-
50
- # Detect method additions to Kernel and remove them in the
51
- # BlankSlate class.
52
- def method_added(name)
53
- basic_object_method_added(name)
54
- return if self != Kernel
55
- BasicObject.hide(name)
56
- end
57
- end
58
- end
59
-
60
- class Object #:nodoc:
61
- class << self
62
- alias_method :basic_object_method_added, :method_added
63
-
64
- # Detect method additions to Object and remove them in the
65
- # BlankSlate class.
66
- def method_added(name)
67
- basic_object_method_added(name)
68
- return if self != Object
69
- BasicObject.hide(name)
70
- end
71
- end
72
- end
73
-
74
- end
@@ -1,288 +0,0 @@
1
- unless defined?(BasicObject)
2
- require 'blankslate'
3
- BasicObject = BlankSlate
4
- end
5
-
6
- # = BasicStruct
7
- #
8
- # BasicStruct is very similar to Ruby's own OpenStruct, but it offers some
9
- # advantages. With OpenStruct, slots with the same name as predefined
10
- # Object methods cannot be used. With BasicStruct, almost any slot can be
11
- # defined. BasicStruct is a subclass of BasicObject to ensure all method
12
- # slots, except those that are absolutely essential, are open for use.
13
- #
14
- #--
15
- # If you wish to pass a BasicStruct to a routine that normal takes a Hash,
16
- # but are uncertain it can handle the distictions properly you can convert
17
- # easily to a Hash using #as_hash! and the result will automatically be
18
- # converted back to an BasicStruct on return.
19
- #
20
- # o = BasicStruct.new(:a=>1,:b=>2)
21
- # o.as_hash!{ |h| h.update(:a=>6) }
22
- # o #=> #<BasicObject {:a=>6,:b=>2}>
23
- #++
24
- #
25
- # Unlike a Hash, all BasicStruct's keys are symbols and all keys are converted
26
- # to such using #to_sym on the fly.
27
-
28
- class BasicStruct < BasicObject
29
-
30
- #PUBLIC_METHODS = /(^__|^instance_|^object_|^\W|^as$|^send$|^class$|\?$)/
31
- #protected(*public_instance_methods.select{ |m| m !~ PUBLIC_METHODS })
32
-
33
- def self.[](hash=nil)
34
- new(hash)
35
- end
36
-
37
- # Inititalizer for BasicObject is slightly different than that of Hash.
38
- # It does not take a default parameter, but an initial priming Hash,
39
- # like OpenStruct. The initializer can still take a default block
40
- # however. To set the default value use <code>#default!(value)</code>.
41
- #
42
- # BasicObject.new(:a=>1).default!(0)
43
- #
44
- def initialize(hash=nil, &yld)
45
- @table = ::Hash.new(&yld)
46
- if hash
47
- hash.each{ |k,v| store(k,v) }
48
- end
49
- end
50
-
51
- #
52
- def initialize_copy(orig)
53
- orig.each{ |k,v| store(k,v) }
54
- end
55
-
56
- # Object inspection.
57
- # TODO: Need to get __class__ and __id__ in hex form.
58
- def inspect
59
- #@table.inspect
60
- hexid = __id__
61
- klass = "BasicObject" # __class__
62
- "#<#{klass}:#{hexid} #{@table.inspect}>"
63
- end
64
-
65
- # Convert to an associative array.
66
- def to_a
67
- @table.to_a
68
- end
69
-
70
- #
71
- def to_h
72
- @table.dup
73
- end
74
-
75
- #
76
- def to_hash
77
- @table.dup
78
- end
79
-
80
- #
81
- def to_basicstruct
82
- self
83
- end
84
-
85
- # Convert to an assignment procedure.
86
- def to_proc(response=false)
87
- hash = @table
88
- if response
89
- ::Proc.new do |o|
90
- hash.each do |k,v|
91
- o.__send__("#{k}=", v) rescue nil
92
- end
93
- end
94
- else
95
- ::Proc.new do |o|
96
- hash.each{ |k,v| o.__send__("#{k}=", v) }
97
- end
98
- end
99
- end
100
-
101
- # NOT SURE ABOUT THIS
102
- def as_hash
103
- @table
104
- end
105
-
106
- # Is a given +key+ defined?
107
- def key?(key)
108
- @table.key?(key.to_sym)
109
- end
110
-
111
- #
112
- def is_a?(klass)
113
- return true if klass == ::Hash # TODO: Is this wise? How to fake a subclass?
114
- return true if klass == ::BasicObject
115
- false
116
- end
117
-
118
- # Iterate over each key-value pair.
119
- def each(&yld)
120
- @table.each(&yld)
121
- end
122
-
123
- # Set the default value.
124
- def default!(default)
125
- @table.default = default
126
- end
127
-
128
- # Check equality.
129
- def ==( other )
130
- case other
131
- when ::BasicStruct
132
- @table == other.as_hash
133
- when ::Hash
134
- @table == other
135
- else
136
- if other.respond_to?(:to_hash)
137
- @table == other.to_hash
138
- else
139
- false
140
- end
141
- end
142
- end
143
-
144
- #
145
- def eql?( other )
146
- case other
147
- when ::BasicStruct
148
- @table.eql?(other.as_hash)
149
- else
150
- false
151
- end
152
- end
153
-
154
- #
155
- def <<(x)
156
- case x
157
- when ::Hash
158
- @table.update(x)
159
- when ::Array
160
- x.each_slice(2) do |(k,v)|
161
- @table[k] = v
162
- end
163
- end
164
- end
165
-
166
- #
167
- def []=(key, value)
168
- @table[key.to_sym] = value
169
- end
170
-
171
- #
172
- def [](key)
173
- @table[key.to_sym]
174
- end
175
-
176
- #
177
- def merge!(other)
178
- BasicObject.new(@table.merge!(other))
179
- end
180
-
181
- #
182
- def update!(other)
183
- @table.update(other)
184
- self
185
- end
186
-
187
- #
188
- def respond_to?(key)
189
- key?(key)
190
- end
191
-
192
- # NOTE: These were protected, why?
193
-
194
- #
195
- def store(k, v)
196
- @table.store(k.to_sym, v)
197
- end
198
-
199
- #
200
- def fetch(k, *d, &b)
201
- @table.fetch(k.to_sym, *d, &b)
202
- end
203
-
204
- protected
205
-
206
- #def as_hash!
207
- # Functor.new do |op,*a,&b|
208
- # result = @table.__send__(op,*a,&b)
209
- # case result
210
- # when Hash
211
- # BasicObject.new(result)
212
- # else
213
- # result
214
- # end
215
- # end
216
- #end
217
-
218
- #def define_slot(key, value=nil)
219
- # @table[key.to_sym] = value
220
- #end
221
-
222
- #def protect_slot( key )
223
- # (class << self; self; end).class_eval {
224
- # protected key rescue nil
225
- # }
226
- #end
227
-
228
- def method_missing(sym, *args, &blk)
229
- type = sym.to_s[-1,1]
230
- key = sym.to_s.sub(/[=?!]$/,'').to_sym
231
- case type
232
- when '='
233
- store(key, args[0])
234
- when '!'
235
- @table.__send__(key, *args, &blk)
236
- # if key?(key)
237
- # fetch(key)
238
- # else
239
- # store(key, BasicObject.new)
240
- # end
241
- when '?'
242
- fetch(key)
243
- else
244
- fetch(key)
245
- end
246
- end
247
-
248
- end
249
-
250
- # Core Extensions
251
-
252
- class Hash
253
- # Convert a Hash into a BasicStruct.
254
- def to_basicstruct
255
- BasicStruct[self]
256
- end
257
- end
258
-
259
- =begin
260
- class NilClass
261
- # Nil converts to an empty BasicObject.
262
- def to_basicstruct
263
- BasicObject.new
264
- end
265
- end
266
-
267
- class Proc
268
- # Translates a Proc into an BasicObject. By droping an BasicObject into
269
- # the Proc, the resulting assignments incured as the procedure is
270
- # evaluated produce the BasicObject. This technique is simlar to that
271
- # of MethodProbe.
272
- #
273
- # p = lambda { |x|
274
- # x.word = "Hello"
275
- # }
276
- # o = p.to_basicstruct
277
- # o.word #=> "Hello"
278
- #
279
- # NOTE The Proc must have an arity of one --no more and no less.
280
- def to_basicstruct
281
- raise ArgumentError, 'bad arity for converting Proc to basicstruct' if arity != 1
282
- o = BasicObject.new
283
- self.call( o )
284
- o
285
- end
286
- end
287
- =end
288
-