Ruby, Rails, Web2.0 » Blog Archive » Sometimes less is more
Ruby, Rails, Web2.0 » Blog Archive » Sometimes less is more
Sometimes less is more
This cool link (credits to Mario Zannone) is for the skeptical readers of this block still not in love with the ruby syntax (as I was and sometimes still I am!)…
iChat to MSN Through Jabber » All Forces
Thanks to Luca Grulla I’ve got the brilliant idea to have all my msn and yahoo accounts inside iChat, here a good tutorial ![]()
iChat to MSN Through Jabber » All Forces
Ruby… Not so bad…
Yuppie, finally I have a project and looks nice, we have to use Ruby on Rails and Ajax, so I’m forced to study a bit this language and the framework.
I’m reading Agile Web Development with Rails, really a good book and after a lazy mac os intallation of Locomotive + RadRails, I’ve moved to a more “hacking” installation following the good tutorial on the blog of James Dunkan.
Right now I’m blocking cos the installation, done using ports takes really ages, compliling and downloading what’s needed…
There are some “features” that I really like of Ruby, for example all member variables are private, to access it you have to write a getter, using the keyword attr, if you want only getter just write attr_reader
[ruby]
class Blog
def initialize(title)
@title = title
end
attr_reader :title
[/ruby]
Nice no?
Another cool thing is that Ruby does not have Multiple Inheritance by the way it has the module concept, so you can have methods for free from another class.
A stupid example can be something like this:
[ruby]
module WebPage
def WebPage.toHtml
# …
end
class Blog
require ‘WebPage’
[/ruby]
An you’ll be able to use that Method on the Blog class.