Sha256: 138283c9707652b24901005cb1a67db8c64f878924df41782343664befabf175
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 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, 'exit', 'quit'], :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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rib-1.0.0 | lib/rib/shell.rb |
rib-0.9.9 | lib/rib/shell.rb |
rib-0.9.5 | lib/rib/shell.rb |