Ruby is the interpreted scripting language for quick and easy object-oriented programming. It is simple, straight-forward, extensible, dynamic, and portable. Similar in scope to Perl and Python, it has high-level data types, automatic memory management, dynamic typing, a module system, exceptions, and a rich standard library.
To help address performance issues, virtual machines for Ruby have been developed, such as JRuby and YARV, which is being integrated into the Ruby distribution.
If you’re investigating Ruby, and building webapps, you’ll want to take a close look at Rails.
You can download Ruby
Visit RubyForge to see some related projects building on or extending the capabilities of Ruby.
Read documentation
And get a 20-minute tutorial
Now that we've gotten Rails integration working with GlassFish, you'd think that we'd be done, and we could move on to making AIs to make toast for us, or something like that. Well, you probably wouldn't since most people don't think that the next thing to do after adding something to an application server is to use AI to make toast, but, if you did think that, you'd be wrong.
#!/usr/bin/ruby
#file: bulkrenamefiles.rb
class BulkRenameFiles
def initialize(h)
h[:dir] = '.' if [:dir].empty?
files = Dir.entries(h[:dir])
files.each do |f|
next if f == "." or f == ".."
oldFile = h[:dir] + "/" + f
newFile = h[:dir] + "/" + f.gsub(/#{h[:exp_search]}/,h[:exp_replace])
File.rename(oldFile, newFile)
end
end
end
if __FILE__ == $0 then
brf = BulkRenameFiles.new(:dir => '.', :exp_search => '^_', :exp_replace => '')
end
-rwxr-xr-x 1 apache apache 178 Aug 2 16:29 class_template.xml
-rwxr-xr-x 1 apache apache 106 Aug 2 16:29 _tasks_data_template.xml
-rwxr-xr-x 1 apache apache 100 Aug 2 19:31 _tasks_today.xml
-rwxr-xr-x 1 apache apache 909 Aug 2 19:31 _tasks.xsl
-rwxr-xr-x 1 apache apache 106 Aug 2 19:56 _tasks2_data.xml
-rw-r--r-- 1 apache apache 267 Aug 2 22:43 _tasks.xml
-rwxr-xr-x 1 apache apache 56 Aug 5 02:10 _tasks_template.xml
-rwxr-xr-x 1 apache apache 2686 Aug 8 19:53 index.xml
-rwxr-xr-x 1 apache apache 2685 Aug 8 19:53 _tasks_data.xml
-rwxr-xr-x 1 apache apache 106 Aug 2 16:29 tasks_data_template.xml
-rwxr-xr-x 1 apache apache 178 Aug 2 16:29 class_template.xml
-rwxr-xr-x 1 apache apache 100 Aug 2 19:31 tasks_today.xml
-rwxr-xr-x 1 apache apache 909 Aug 2 19:31 tasks.xsl
-rwxr-xr-x 1 apache apache 106 Aug 2 19:56 tasks2_data.xml
-rw-r--r-- 1 apache apache 267 Aug 2 22:43 tasks.xml
-rwxr-xr-x 1 apache apache 56 Aug 5 02:10 tasks_template.xml
-rwxr-xr-x 1 apache apache 2685 Aug 8 19:53 tasks_data.xml
-rwxr-xr-x 1 apache apache 2686 Aug 8 19:53 index.xml