Sha256: 8bd38860437fee22a2a4da07976be75ac82552e709abf17c7730aa645dd7356f

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

Contents

#!/usr/bin/env ruby
# An interactive shell for Rumai.
#--
# Copyright 2006 Suraj N. Kurapati
# See the file named LICENSE for details.

require 'irb'
require 'irb/completion'

module IRB
  # Starts an IRB session *inside* the given object.
  #--
  # This code was adapted from a snippet on Massimiliano Mirra's website:
  # http://www.therubymine.com/articles/2007/01/29/programmare-dallinterno
  def self.start_session aContextObj
    setup nil
    session = Irb.new(WorkSpace.new(aContextObj))
    @CONF[:MAIN_CONTEXT] = session.context
    catch(:IRB_EXIT) { session.eval_input }
  end
end

# the basename() is for being launched by a RubyGems executable
if __FILE__ == $0 or File.basename(__FILE__) == File.basename($0)
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')

  if ARGV.first =~ /-v|--version/i
    require 'rumai/nfo'

    puts "%s %s (%s) %s %s" % [
      :name, :version, :release, :website, :home
    ].map {|m| Rumai::NFO[m] }

  else
    require 'rumai'
    IRB.start_session Rumai
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rumai-1.0.0 bin/rumai
rumai-2.0.0 bin/rumai