Sha256: 924d722e5aa3aa63002ce731df17c7c8cf2854e99d2a243d6b82cdb0fe542d0b
Contents?: true
Size: 801 Bytes
Versions: 12
Compression:
Stored size: 801 Bytes
Contents
require 'rib/plugin' require 'rib/api' class Rib::Shell include Rib::API trap('INT'){ raise Interrupt } def self.use mod include mod end attr_reader :config def initialize(config={}) self.config = { :result_prompt => '=> ' , :prompt => '>> ' , :binding => TOPLEVEL_BINDING, :exit => [nil] , :line => 1 }.merge(config) @running = false end # Loops shell until user exits def loop before_loop @running = true in_loop self rescue Exception => e Rib.warn("Error while running loop:\n #{format_error(e)}") raise ensure @running = false after_loop end def running? !!@running end protected attr_writer :config end
Version data entries
12 entries across 12 versions & 1 rubygems