» tagged pages
» logout

(Feed found, click Add Page to syndicate.) Error finding feed, please try again » Find feed title

A Blog Page allows you to add entries, for news or other time sensitive postings

(Login required to save to your tagged pages.)
(or Cancel)

Make further edits, (or Cancel)

(Login required to save to your tagged pages.)
(or Cancel)

(Editing anonymously: to be credited for your changes, login or register a new account)

Change Page Permissions? Changing these permissions will adjust who can modify this page.

alex (change)
Swik Users (change)
(or Cancel)
Upload an image from your computer:
or Copy an image from a URL:
or Erase the current icon:
Icon Preview:

or Cancel

Erase Ruby? The contents of Ruby page and all pages directly attached to Ruby will be erased.

or Cancel

(Editing anonymously: to be credited for your changes, login or register a new account)

other page actions:
Ruby

Ruby

Tags Applied to Ruby

4 people have tagged this page:

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

www.ruby-lang.org
, MIT-like, or at your option

sorted by: recent | see : popular
Content Tagged Ruby

More is Better

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.

technology: dzone.com: tech links

Search and replace filenames using Ruby

This script searches and replaces file names within a file directory.


#!/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


output before:
-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


output after:

-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


Source: Renaming files using ruby! - by Ruby on Rails [rubyonrailsexamples.com]

Ruby: Code Snippets: ruby

Page 1 | Next >>
Username:
Password:
(or Cancel)