21 Apr, 2009 in
Ruby by
khelll
It’s a basic question that I myself had a problem with when i started using Ruby: Does Ruby pass by value or by reference?
Well, if you want a direct answer, then: Ruby passes by value. It’s a similar behavior of what Java does.
Let’s prove it via examples:
Update: this example was passing integers, and it [...]
11 Jan, 2009 in
JRuby,
Java,
Ruby by
khelll
It’s true that I’m not the qualified guy to talk about Java’s power,as it has been 2 years since i last practiced it, but i feel like i have to communicate my thoughts to the people that didn’t give JRuby a trial yet, and why they should do so.
If you never worked with Java before, [...]
6 Jan, 2009 in
Ruby by
khelll
I keep seeing many programmers from different backgrounds are unable to get what Ruby symbols are, and though I do know that there are many great posts regarding this topic, and actually my intent is not to increase them by one , but I feel I have to clear few points regarding them.
So [...]
31 Dec, 2008 in
Ruby by
khelll
According to wikipedia, Metaprogramming:
is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at runtime that would otherwise be done at compile time.
Well, nice to hear cause Ruby is a lang that supports Metaprogramming effectively, and might be the best in [...]
30 Dec, 2008 in
Ruby by
khelll
A Domain-specific language(DSL) is a computer language that’s targeted to a particular kind of problem, rather than a general purpose language that’s aimed at any kind of software problem. Domain specific languages have been talked about, and used for almost as long as computing has been done. Regular expressions and CSS are 2 examples of [...]
28 Dec, 2008 in
Ruby by
khelll
This blog post is about ruby’s callbacks(hooks): what are the available ones,and how practically we can use them?
method_missing
obj.method_missing(symbol [, *args] ) => result might be the most famous hook in ruby, and is being used a lot by ruby developers :
Invoked by Ruby when obj is sent a message it cannot handle. symbol [...]
26 Dec, 2008 in
Ruby by
khelll
This is the second post related to ruby’s reflection API, the previous post was an extensive intro to this topic. While the current one will be lighter somehow, it would require you to focus a bit more on the content.
Here we go:
Setting, getting and removing instance variables :
# Define a simple class M
class M ; [...]
19 Dec, 2008 in
Ruby by
khelll
If you are here, then most probably you want to know more about ruby reflection interface. Well that’s true, but I always find myself in need to explain few things before I get started with my posts, and this time I find myself in need of explaining few things related to ruby’s OOP.
I’m pretty sure [...]
I wanted to start blogging on ruby reflection api, but i just realized that i have to give a second part of my previous article on ruby introspection .
So here we go:
s = ”
# s.is_a? String, this is the same!
String === s
# Determines whether the object has a public or protected method with [...]
I’m pretty sure that you have heard lots about ruby, specially as being a dynamic language, you can create methods on the fly, add instance variables, define constants and invoke existing methods dynamically , and that’s what this post is all about :
As you know in ruby you can call a public instance method directly [...]