Programming Tutorials

ruby Tutorials

41. pretty() in Ruby

By: Jeeva : 2009-03-03

Description: Prettify (indent) an HTML string


42. Format a Time object as a String in Ruby

By: Jeeva : 2009-03-03

Description: Format a Time object as a String using the format specified by RFC 1123.


43. URL decode a string in Ruby

By: Jeeva : 2009-03-03

Description: URL-decode a string


44. The Question Mark Operator in Ruby on rails

By: Brian Marick : 2008-10-17

Description: This ?: construct is called either the question mark operator or, more question mark operator often, the ternary operator. ("Ternary" because it uses three expres- ternary operator sions, unlike operators such as +, which have two and are called binary operators.) binary operators


45. unless in Ruby on rails

By: Brian Marick : 2008-10-17

Description: The word "unless" is in the English language for a reason. Contrast "unless the judge is unfair, you'll win" with "if the judge is not unfair, you'll win." Negations - especially negations of already negative ideas can be confusing. The same is true of Ruby code:


46. if . . . elsif . . . else in Ruby on rails

By: Brian Marick : 2008-10-17

Description: Here is Ruby's if statement in all its glory, wrapped in a method:


47. Methods in Ruby on rails

By: Brian Marick : 2008-10-17

Description: Ruby methods let you create new verbs (messages) in the Ruby lan- methods guage. It's a bit confusing that two closely related ideas—messages and methods—have such similar names.


48. Command-line Arguments in Ruby on rails

By: Brian Marick : 2008-10-17

Description: Command-line arguments are available as strings in the array named ARGV. For example, consider this command line:


49. Naming conventions in Ruby on rails

By: Brian Marick : 2008-10-17

Description: A Ruby name may contain letters, numbers, and the underscore character (not a hyphen). Names can't begin with a number, nor may they include spaces. Case matters: my_ship is not the same name as my_Ship.


50. Prompts, Command Lines, Prompts, and irb in Ruby on rails

By: Balram Thakar : 2008-10-17

Description: There are two kinds of prompts command-line prompts and irb prompts. If you type a command meant for the command-line interpreter to irb (or vice versa), you'll get confusing results. If what you see on your screen is nothing like what the book tells you to expect, check that you're typing at the right prompt.