[macruby-changes] [4837] DietRB/trunk/lib/irb/context.rb
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 28 03:32:29 PDT 2010
Revision: 4837
http://trac.macosforge.org/projects/ruby/changeset/4837
Author: eloy.de.enige at gmail.com
Date: 2010-10-28 03:32:25 -0700 (Thu, 28 Oct 2010)
Log Message:
-----------
Add a simple #inspect implementation for IRB::Context.
Modified Paths:
--------------
DietRB/trunk/lib/irb/context.rb
Modified: DietRB/trunk/lib/irb/context.rb
===================================================================
--- DietRB/trunk/lib/irb/context.rb 2010-10-28 04:59:44 UTC (rev 4836)
+++ DietRB/trunk/lib/irb/context.rb 2010-10-28 10:32:25 UTC (rev 4837)
@@ -26,6 +26,13 @@
def __evaluate__(source, file = __FILE__, line = __LINE__)
eval(source, @binding, file, line)
end
+
+ def to_s
+ object_description = "`#{object.inspect}'"
+ object_description = "of class `#{object.class.name}'" if object_description.length > 32
+ "#<IRB::Context for object #{object_description}>"
+ end
+ alias_method :inspect, :to_s
def evaluate(source)
result = __evaluate__(source.to_s, '(irb)', @line - @source.buffer.size + 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101028/e96ccccd/attachment-0001.html>
More information about the macruby-changes
mailing list