Sha256: dffddf3340f499c772a3aa6ee388c36be0c9f9d14c4b8a155dc44e2792d2c492

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 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 = {
      :name          => 'rib'                    ,
      :result_prompt => '=> '                    ,
      :prompt        => '>> '                    ,
      :binding       => TOPLEVEL_BINDING         ,
      :exit          => [nil, 'exit', 'quit']    ,
      :line          => 1
    }.merge(config)
  end

  # Loops shell until user exits
  def loop
    before_loop
    @running = true
    in_loop
    self
  ensure
    @running = false
    after_loop
  end

  def running?
    !!@running
  end

  protected
  attr_writer :config
  attr_accessor :error_raised
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rib-0.1.0 lib/rib/shell.rb