lib/rib/api.rb in rib-1.1.0 vs lib/rib/api.rb in rib-1.1.1
- old
+ new
@@ -1,10 +1,8 @@
module Rib; end
module Rib::API
- extend self
-
# Called before shell starts looping
def before_loop
self
end
@@ -23,9 +21,13 @@
def name ; config[:name] ; end
# The binding for evaluation
def eval_binding ; config[:binding] ; end
# The line number for next evaluation
def line ; config[:line] ; end
+ # The object for the current binding
+ def bound_object
+ config[:bound_object] ||= eval_binding.eval('self', __FILE__, __LINE__)
+ end
# Main loop
def in_loop
input = catch(:rib_exit){ loop_once while true }
puts if input == nil