| < | September 2006 | > | ||||
| Su | Mo | Tu | We | Th | Fr | Sa |
| 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 |
Oh yes, I am getting more and more impressed with Ruby.
Ruby being an apparently *very* simple and aesthetically pleasing language, but internally it is very complex in its implementation along with quite a few awesome and very intelligent hacks.
People interested in giving ruby a shot should surely start with the
following:
* About Ruby
* Ruby in 20 min
People interested in Ruby internals can take a look at "Ruby Hacking Guide".
Oh and before saying bye for the day, I would love to give away some fun.
A nice and *probably* usable ruby shell ;-)
#!/usr/bin/ruby
require 'readline'
class RShell
def initialize()
Signal.trap('INT') {
puts "Enter exit/quit to exit shell"
}
end
def unixcmd?(cmd = nil)
return nil unless cmd
paths = ENV["PATH"].split(':')
paths.each do |p|
file = "#{p}/#{cmd.split(' ',2)[0]}"
return true if File.exists? file
end
false
end
def run
loop do
cmd = Readline::readline("rsh #{ENV['PWD']}> $ ", true)
exit if cmd =~ /exit|quit/
if unixcmd? cmd
system(cmd)
else
begin
eval cmd
rescue
puts "Command not found"
end
end
end
end
end
RShell.new.run
posted at: 16:28 | path: / | permanent link to this entry