Irb: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(This page must use the Rübÿ Spëëd Mëtäl Cödïng template!!!111) |
Sven (Diskussion | Beiträge) |
||
Zeile 48: | Zeile 48: | ||
end | end | ||
</pre> | </pre> | ||
=Tab completion= | =Tab completion und Einrückung= | ||
<pre> | <pre> | ||
IRB.conf[:AUTO_INDENT] = true | |||
IRB.conf[:USE_READLINE] = true | |||
IRB.conf[:LOAD_MODULES] ||= [] | |||
IRB.conf[:LOAD_MODULES] |= ['irb/completion'] | |||
</pre> | </pre> | ||
Version vom 27. Mai 2006, 07:37 Uhr
History
HISTFILE = "~/.irb.hist" MAXHISTSIZE = 10000 begin if defined? Readline::HISTORY histfile = File::expand_path( HISTFILE ) if File::exists?( histfile ) lines = IO::readlines( histfile ).collect {|line| line.chomp} puts "Read %d saved history commands from %s." % [ lines.nitems, histfile ] if $DEBUG || $VERBOSE Readline::HISTORY.push( *lines ) else puts "History file '%s' was empty or non-existant." % histfile if $DEBUG || $VERBOSE end Kernel::at_exit { lines = Readline::HISTORY.to_a.reverse.uniq.reverse lines = lines[ -MAXHISTSIZE, MAXHISTSIZE ] if lines.nitems > MAXHISTSIZE $stderr.puts "Saving %d history lines to %s." % [ lines.length, histfile ] if $VERBOSE || $DEBUG File::open( histfile, File::WRONLY|File::CREAT|File::TRUNC ) {|ofh| lines.each {|line| ofh.puts line } } } end end
ri in irb
def ri arg puts `ri #{arg}` end class Module def ri(meth=nil) if meth if instance_methods(false).include? meth.to_s puts `ri #{self}##{meth}` else super end else puts `ri #{self}` end end end
Tab completion und Einrückung
IRB.conf[:AUTO_INDENT] = true IRB.conf[:USE_READLINE] = true IRB.conf[:LOAD_MODULES] ||= [] IRB.conf[:LOAD_MODULES] |= ['irb/completion']
Rübÿ Spëëd Mëtäl Cödïng
Projects: CacaANSICam | Date Determinator | DVB-Scraping | Filmnächte-Scraping | GeeKal | Gruntmaster | Harvester | Hirn | Irb | Jargon-File | Ruby-MediaWiki | Miniwebserver | Momomoto | Pentabarf | Podcast-fetching | Ruby | Ruby-Geekend | Ruby und Ruby on Rails | Sedusa | VDS-Badges | Xmotoctl | Youtube-Scraping