sam / do fork watch download tarball
public
Rubygem
Description: DataObjects
Homepage: http://rubyforge.org/projects/dorb
Clone URL: git://github.com/sam/do.git
Improved error messages from class_eval

Adding the optional paramaters __FILE__ and __LINE__ to class_eval
helps with debugging.
djwonk (author)
Sat Jul 05 08:23:27 -0700 2008
commit  3e8229ce9c5e5c77abef435a5683838d6fb0082d
tree    da03f1a685364f61322e149ea1e225319bc473f6
parent  7c55c5006ac12a767f473ad0731d0d3f4f43a356
...
36
37
38
39
 
40
41
42
...
36
37
38
 
39
40
41
42
0
@@ -36,7 +36,7 @@ module DataObjects
0
 
0
       if driver_module_name = target.name.split('::')[-2]
0
         driver_module = DataObjects::const_get(driver_module_name)
0
- driver_module.class_eval <<-EOS
0
+ driver_module.class_eval <<-EOS, __FILE__, __LINE__
0
           def self.logger
0
             @logger
0
           end
...
213
214
215
216
217
218
219
220
 
 
 
 
 
221
222
223
224
225
226
227
228
 
 
 
 
 
229
230
231
...
213
214
215
 
 
 
 
 
216
217
218
219
220
221
222
223
 
 
 
 
 
224
225
226
227
228
229
230
231
0
@@ -213,19 +213,19 @@ module DataObjects
0
     # :off only gets an off? method
0
     LEVELS.each_pair do |name, number|
0
       unless name.to_sym == :off
0
- class_eval <<-EOS
0
- # DOC
0
- def #{name}(message)
0
- self.<<( prep_msg(message, "#{name}") ) if #{name}?
0
- end
0
+ class_eval <<-EOS, __FILE__, __LINE__
0
+ # DOC
0
+ def #{name}(message)
0
+ self.<<( prep_msg(message, "#{name}") ) if #{name}?
0
+ end
0
         EOS
0
       end
0
 
0
- class_eval <<-EOS
0
- # DOC
0
- def #{name}?
0
- #{number} >= level
0
- end
0
+ class_eval <<-EOS, __FILE__, __LINE__
0
+ # DOC
0
+ def #{name}?
0
+ #{number} >= level
0
+ end
0
       EOS
0
     end
0
 

Comments

    No one has commented yet.