Module Bio::Shell::Core
In: lib/bio/shell/core.rb

bio/shell/core.rb - internal methods for the BioRuby shell

Copyright:Copyright (C) 2005, 2006 Toshiaki Katayama <k@bioruby.org>
License:The Ruby License

$Id:$

Methods

Constants

SHELLDIR = "shell"
DATADIR = "data"
SESSION = File.join(SHELLDIR, "session")
PLUGIN = File.join(SHELLDIR, "plugin")
SCRIPT = File.join(SHELLDIR, "script.rb")
CONFIG = File.join(SESSION, "config")
OBJECT = File.join(SESSION, "object")
HISTORY = File.join(SESSION, "history")
BIOFLAT = File.join(DATADIR, "bioflat")
MARSHAL = [ Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION ]
MESSAGE = "...BioRuby in the shell..."
ESC_SEQ = { :k => "\e[30m", :black => "\e[30m", :r => "\e[31m", :red => "\e[31m", :ruby => "\e[31m", :g => "\e[32m", :green => "\e[32m", :y => "\e[33m", :yellow => "\e[33m", :b => "\e[34m", :blue => "\e[34m", :m => "\e[35m", :magenta => "\e[35m", :c => "\e[36m", :cyan => "\e[36m", :w => "\e[37m", :white => "\e[37m", :n => "\e[00m", :none => "\e[00m", :reset => "\e[00m", }

Public Instance methods

[Source]

    # File lib/bio/shell/core.rb, line 83
83:   def ask_yes_or_no(message)
84:     loop do
85:       STDERR.print "#{message}"
86:       answer = gets
87:       if answer.nil?
88:         # readline support might be broken
89:         return false
90:       elsif /^\s*[Nn]/.match(answer)
91:         return false
92:       elsif /^\s*[Yy]/.match(answer)
93:         return true
94:       else
95:         # loop
96:       end
97:     end
98:   end

[Source]

    # File lib/bio/shell/core.rb, line 79
79:   def bioflat_dir
80:     File.join(@cache[:savedir], BIOFLAT)
81:   end

[Source]

    # File lib/bio/shell/core.rb, line 39
39:   def colors
40:     ESC_SEQ
41:   end

[Source]

    # File lib/bio/shell/core.rb, line 67
67:   def config_file
68:     File.join(@cache[:savedir], CONFIG)
69:   end

[Source]

    # File lib/bio/shell/core.rb, line 47
47:   def data_dir
48:     File.join(@cache[:savedir], DATADIR)
49:   end

[Source]

    # File lib/bio/shell/core.rb, line 75
75:   def history_file
76:     File.join(@cache[:savedir], HISTORY)
77:   end

[Source]

    # File lib/bio/shell/core.rb, line 71
71:   def object_file
72:     File.join(@cache[:savedir], OBJECT)
73:   end

[Source]

    # File lib/bio/shell/core.rb, line 55
55:   def plugin_dir
56:     File.join(@cache[:savedir], PLUGIN)
57:   end

[Source]

    # File lib/bio/shell/core.rb, line 63
63:   def script_dir
64:     File.dirname(script_file)
65:   end

[Source]

    # File lib/bio/shell/core.rb, line 59
59:   def script_file
60:     File.join(@cache[:savedir], SCRIPT)
61:   end

[Source]

    # File lib/bio/shell/core.rb, line 51
51:   def session_dir
52:     File.join(@cache[:savedir], SESSION)
53:   end

[Source]

    # File lib/bio/shell/core.rb, line 43
43:   def shell_dir
44:     File.join(@cache[:savedir], SHELLDIR)
45:   end

[Validate]