Module: Bio::Shell::Core
- Included in:
- Ghost
- Defined in:
- lib/bio/shell/core.rb
Overview
bio/shell/core.rb - internal methods for the BioRuby shell
- Copyright
-
Copyright © 2005, 2006 Toshiaki Katayama <[email protected]>
- License
-
The Ruby License
$Id:$
Constant Summary collapse
- 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", }
Instance Method Summary collapse
- #ask_yes_or_no(message) ⇒ Object
- #bioflat_dir ⇒ Object
- #colors ⇒ Object
- #config_file ⇒ Object
- #data_dir ⇒ Object
- #history_file ⇒ Object
- #object_file ⇒ Object
- #plugin_dir ⇒ Object
- #script_dir ⇒ Object
- #script_file ⇒ Object
- #session_dir ⇒ Object
- #shell_dir ⇒ Object
Instance Method Details
#ask_yes_or_no(message) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/bio/shell/core.rb', line 83 def ask_yes_or_no() loop do STDERR.print "#{}" answer = gets if answer.nil? # readline support might be broken return false elsif /^\s*[Nn]/.match(answer) return false elsif /^\s*[Yy]/.match(answer) return true else # loop end end end |
#bioflat_dir ⇒ Object
79 80 81 |
# File 'lib/bio/shell/core.rb', line 79 def bioflat_dir File.join(@cache[:savedir], BIOFLAT) end |
#config_file ⇒ Object
67 68 69 |
# File 'lib/bio/shell/core.rb', line 67 def config_file File.join(@cache[:savedir], CONFIG) end |
#data_dir ⇒ Object
47 48 49 |
# File 'lib/bio/shell/core.rb', line 47 def data_dir File.join(@cache[:savedir], DATADIR) end |
#history_file ⇒ Object
75 76 77 |
# File 'lib/bio/shell/core.rb', line 75 def history_file File.join(@cache[:savedir], HISTORY) end |
#object_file ⇒ Object
71 72 73 |
# File 'lib/bio/shell/core.rb', line 71 def object_file File.join(@cache[:savedir], OBJECT) end |
#plugin_dir ⇒ Object
55 56 57 |
# File 'lib/bio/shell/core.rb', line 55 def plugin_dir File.join(@cache[:savedir], PLUGIN) end |
#script_dir ⇒ Object
63 64 65 |
# File 'lib/bio/shell/core.rb', line 63 def script_dir File.dirname(script_file) end |
#script_file ⇒ Object
59 60 61 |
# File 'lib/bio/shell/core.rb', line 59 def script_file File.join(@cache[:savedir], SCRIPT) end |