Questions tagged [ruby]

Questions about Ruby, dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features.

Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto. It was influenced primarily by Perl, Smalltalk, Eiffel, and Lisp.

289 questions
57
votes
3 answers

What is a symbol in Ruby?

I'm totally new to the Ruby world, and I'm a bit confused with the concept of Symbols. What's the difference between Symbols and Variables? Why not just using variables? Thanks.
wassimans
  • 1,173
20
votes
8 answers

Ruby: The Bad Parts

I recently read Crockford's book "Javascript: The Good Parts" and one of the underlying premises was that programming languages can have bad sets of features which programmers should avoid. I'm a Rubyist and whilst I love the language there's always…
13
votes
7 answers

Where is the best place to teach myself a language, and which one?

I do not know any programming languages at all. I will self teach myself and need to know the best place to do so where I can learn from a most basic level. Where is a great place to begin learning a language? What language is best to learn…
lorindaapps
  • 233
  • 1
  • 5
10
votes
2 answers

Why if statements do not introduce scope in ruby 1.9?

if statements do not introduce scope in Ruby 1.9, what is the rationale behind this change from ruby 1.8?
ohho
  • 1,292
9
votes
6 answers

How do I showcase my work experience in programming?

I'm a student of web development languages like PHP, Ruby, and Python. Currently I'm working on some school projects but I'm trying to work on some weekend projects which I can use to showcase for potential employers, what's the best way to set this…
7
votes
6 answers

Is it okay to define a [] method in ruby's NilClass?

Ruby by default does not include the method [] for NilClass For example, to check if foo["bar"] exists when foo may be nil, I have to do: foo = something_that_may_or_may_not_return_nil if foo && foo["bar"] # do something with foo["bar"]…
7
votes
1 answer

Is the puts function of ruby a method of an object?

I'm trying to understand how the puts function fits in Ruby's "Everything is an object" stance. Is puts is the method of a somehow hidden class/object? Or is it a free-floating method, with no underlying object?
gyin
  • 185
5
votes
5 answers

Why would you want to use an array, or hash as hash key in ruby?

i'm using Ruby 1.9.3 I figured out that you can use an array, or a hash as hash key in ruby: h = Hash.new h[Array.new] = "Why?" h[Array.new] # Output: "Why?" h[Hash.new] = "It doesn't make sense" h[Hash.new] # Output: "It doesn't make sense" But…
random_guy
  • 109
  • 1
  • 7
4
votes
1 answer

Ruby: how to step through ruby code

I'm trying to learn how to step through Ruby code (written by more experienced programmers) in order to improve my knowledge of Ruby. Problem is that I don't really know how to do it well. Googling the topic brought me to an about.com page on Ruby;…
4
votes
2 answers

Ruby Sinatra best practices for project structure

Many people praise Sinatra's ability to create simple projects in a single file. This is great and all but what if I want to use Sinatra for slightly larger project? I'm fairly new to Ruby as a whole but have already found a couple ways to create a…
Mike
  • 171
3
votes
2 answers

Why does assigning a variable to false return false?

Why does: something = false always return false? Since it is an assignment and not a comparison, it seems it would make more sense to return the result (success/failure) of the assignment (like pretty much every other assignment you do). EDIT -…
bcb
  • 133
3
votes
1 answer

When can one call themselves a "Rubyist"?

I was wondering what that term even meant. Is it something to do with one's amount of knowledge about the Ruby language or just the plain idea of using it. When can one call themselves a "Rubyist"?
user79317
3
votes
1 answer

What comes first, the ruby chicken or the homebrew egg?

Whilst installing Ruby on OsX I noticed I could do so by using a package manager called Homebrew. This seemed like an easy option, so I took it. Everything worked smoothly. Life was good. Being a curious fellow, I looked into what other benefits…
Mild Fuzz
  • 1,562
2
votes
1 answer

Symbol definition in Ruby

I am a beginner in Ruby and I am trying to wrap my head around symbols. Would you say that my current understanding, summarized in the following (oversimplified) definition, is true for most purposes? "A symbol is a string constant with its name…
1
vote
2 answers

Ruby Terminology Question: Implicit Declaration or no declaration at all?

I have a question, because in most serious sources I read, all say the same No variable is ever declared in Ruby, but still I have doubts, because according to what I was taught in my university implicit declaration is when a variable is created via…
OiciTrap
  • 729
1
2