My name is Edward Tanguay. I am a web developer in Berlin, Germany. I learn everything I can and record it on this site.
Other things you might be looking for:
My Ubuntu Tutorial
My Datapod Project
My Blog Feed:
More on Ruby:  wiki.en  wiki.de  wiki.fr  google  blogs  amazon.com  amazon.de  
Ruby
Most Recent Items
Code Example: Simple function and parameter syntax
RUBY CODE EXAMPLE - added on May 27, 2007
Here is how to do functions in ruby, note the parameter syntax that is used often in Rails.
SHOW CODE

post comment or question
Code Example: How to iterate with each
RUBY CODE EXAMPLE - added on May 24, 2007
Ruby has a unique and terse iterator, what is between the pipes is the variable, that's it.
SHOW CODE

Karen: I am looking for a way to have ruby execute a command for example rake. Is it possible to do so? Thanks much in advance!
arrow pointing right
Sean Kellogg: In Ruby it is possible to execute shell commands by using the command expansion form: %{command} where command is the text you would ordinarily write on the command line. For example, tests.each do |test| puts "running #{test} starting ..." %x{rake #{test}} puts "test #{test} completed" end Also possible is to enclose the command in backticks like this: `command`
arrow pointing right
Sean Kellogg: If the above was unclear (due to suppressed newline characters) try the following iterator: tests.each { |test| %x{rake #{test}} }
arrow pointing right
reply
post comment or question
Code Example: How to use symbols in hashes
RUBY CODE EXAMPLE - added on May 24, 2007
When you use Rails, symbols are use in hashs (since they take up less storage).
SHOW CODE

post comment or question
Code Example: How to set an array to the numbers 10 to 20.
RUBY CODE EXAMPLE - added on May 24, 2007
Use the .. or the ... (to exclude the last number, i.e. 20). The "to_a" means "to array".
SHOW CODE

post comment or question
Code Example: How to user attr_reader for properties
RUBY CODE EXAMPLE - added on April 16, 2007
Shows you how attr_reader simplifies properties.
SHOW CODE

post comment or question
Code Example: How to use attributes in ruby
RUBY CODE EXAMPLE - added on September 17, 2006
This basic code shows you how easy it is to use getters and setters in ruby.
SHOW CODE

post comment or question
Code Example: How to add to a base method
RUBY CODE EXAMPLE - added on September 17, 2006
This code shows you how you can use the super command to call base methods.
SHOW CODE

post comment or question
Code Example: How to call methods from the base class
RUBY CODE EXAMPLE - added on September 17, 2006
Shows how to use the keyword super to call a base class method.
SHOW CODE

post comment or question
Code Example: How to extend a class
RUBY CODE EXAMPLE - added on September 17, 2006
Notice here how you can extend a class (even a system class) at any time just by making a new definition of the class and adding a method, like partial classes in C#.
SHOW CODE

post comment or question
Code Example: Very simple class example in Ruby
RUBY CODE EXAMPLE - added on September 14, 2006
This shows how to make a class in ruby, notice how you have have partial classes (like in C# 2.0) defined anywhere and they fit together as one class.
SHOW CODE

post comment or question
Code Example: Ruby basics: arrays, hashes, if, while, regular expressions, iterating
RUBY CODE EXAMPLE - added on September 14, 2006
This code will teach you some basics of Ruby, note the wierd way of iterating with method calls.
SHOW CODE

post comment or question
Code Example: How to include a library file of classes/functions into a ruby page
RUBY CODE EXAMPLE - added on September 8, 2006
This shows you how to use "require" to emulate PHP's include() command so that you can include libraries in your ruby pages. It seems that the library files need to have the extension ".rb".
SHOW CODE

post comment or question
Code Example: Simple functions in Ruby
RUBY CODE EXAMPLE - added on September 8, 2006
This is the easiest way to make functions out of any language I've tried. Make sure the function comes BEFORE the code that uses it.
SHOW CODE

post comment or question
Code Example: Ruby HelloWorld for web
RUBY CODE EXAMPLE - added on September 8, 2006
This is the simplest code I got to work on my provider. Note that you need the .htaccess file in the same directory and you need to set the rights on this file to 755.
SHOW CODE

post comment or question
This site was made with Datapod.