Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
#!/usr/local/bin/ruby # # save this file in your $RUBY_LIB/site_ruby/1.8/irb/ext/save-history.rb # if you installed your ruby via macports, that'd be # /opt/local/lib/ruby/site_ruby/1.8/irb/ext/save-history.rb # # souped up version of: # save-history.rb - # $Release Version: 0.9.5$ # $Revision: 11708 $ # $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $ # by Keiju ISHITSUKAkeiju@ruby-lang.org) # # -- # # # @RCS_ID='-$Id: save-history.rb 11708 2007-02-12 23:01:19Z shyouhei $-' end unless (class<<@io;self;end)(HistorySavingAbility) @io(HistorySavingAbility) end end IRB[:SAVE_HISTORY] end IRB[:SAVE_HISTORY] = val if val main_context = IRB[:MAIN_CONTEXT] main_context = self unless main_context main_context end end IRB[:HISTORY_FILE] end IRB[:HISTORY_FILE] = hist end end include Readline # file should be a valid file_path to the history file # number_of_lines should be an Integer with the number of history lines to save if number_of_lines && number_of_lines > 0 then path = File(file) File(path, 'w') do |f| history = history if erasedups # Instead of hist[-num..-1] || hist, we can just use Array#last f(history(number_of_lines)) end end end # A finalizer is NOT guaranteed to run, bad choice for history saving # mechanism Kernel do begin HistorySavingAbility( IRB[:HISTORY_FILE] || IRB("_history"), IRB[:SAVE_HISTORY], HISTORY, IRB[:HISTORY_NO_DUPS] ) rescue puts $!, *$! raise end end obj obj end hist = IRB[:HISTORY_FILE] hist = IRB("_history") unless hist File(hist) do |line| HISTORY << line end rescue Errno # history file doesn't yet exist end end end |