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

learn more… | top users | synonyms

6
votes
6answers
708 views

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 ...
4
votes
7answers
564 views

Getting my younger brother started on programming [closed]

My younger brother is 13 years old, I started programming when I started to develop Android applications when I was 15, last year my brother gained an interest in it and he would always pestering me ...
0
votes
1answer
132 views

How do global cancel/exit commands work in bash?

As I have done multiple times before, I've written bash scripts, and just general commands that go nowhere. They just blink the little command line cursor at me for infinity until I control+C the ...
5
votes
2answers
461 views

What can procs and lambdas do that functions can't in ruby

I've been working in Ruby for the last couple weeks, and I've come to the subject of procs, lambdas and blocks. After reading a fair share of examples from a variety of sources, I don't how they're ...
0
votes
1answer
979 views

Ruby: how to step through ruby code [closed]

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 ...
5
votes
2answers
621 views

How relevant is UTF-7 when it comes to parsing emails?

I recently implemented incoming emails for an application and boy, did I open the gates of hell? Since then every other day an email arrives that makes the app fail in a different way. One of those ...
1
vote
2answers
366 views

What is faster and preferable way for variable assignment in ruby? [closed]

I am a RoR developer and want to clarify some doubt about ruby variable assignment. In ruby we have two ways for variable assignment. str, arr, num = "Hi", [1, 2], 3 and str = "Hi" arr = [1, 2] ...
8
votes
3answers
9k views

Can we create desktop application with Ruby? [closed]

I know the Ruby on Rails framework is only for web development and not suitable for desktop application development. But if a ruby programmer wants to develop a desktop application, is it suitable and ...
2
votes
2answers
393 views

Should I prefer instance methods over class methods in Ruby?

I'm working on a rails application, and I've been pulling functionality out of my rails code and into pure ruby classes in lib/. I've found myself often writing classes like this: class ...
1
vote
2answers
849 views

Is it worth converting a Django project to Rails?

I have a project I shelved a while back- it was essentially a working web app built in django but I stopped working on it to work on something else. I plan on starting it up again in my spare time, ...
1
vote
2answers
742 views

How do I read API documentation?

I've been trying to read through the RoR API to try to learn things that the tutorial missed, and I haven't been able to follow it at all. The only time I've read documentation was when I needed to ...
2
votes
3answers
285 views

What is a legitimate reason to use Cucumber?

I've worked in several contracts where the client used Cucumber and I've often felt that the testing suite didn't really have a place in our stack. From what I understand, business ...
1
vote
3answers
267 views

Ruby/RoR development: desktop or server [closed]

Our company has started development of own systems "in-house". We already got couple of developers, who will be responsible for writing code in Ruby/RoR. We are currently discussing infrastructure, ...
2
votes
1answer
168 views

Is it possible to use RubyGnome2's/QtRuby's HTML renderers to make UI for a Ruby script?

I'd like to make a graphical user interface for my script, instead of running it from the console. I'm aware there's a wealth of UI libraries for Ruby, but I'm quite familiar with HTML and CSS and I'd ...
3
votes
6answers
5k views

How much Ruby should I learn before moving to Rails?

Just a quick question.. I can never get a definitive answer when googling this, either. Some people say you can learn Rails without knowing any Ruby, but at some point you'll run into a brick wall and ...
25
votes
7answers
3k views

Explanation on how “Tell, Don't Ask” is considered good OO

This blogpost was posted on Hacker News with several upvotes. Coming from C++, most of these examples seem to go against what I've been taught. Such as example #2: Bad: def ...
1
vote
2answers
110 views

Cataloging events, projects and tasks: Is SQL appropriate?

I have this idea for a database: it would hold everything I "need to remember", and allow future coding projects to access the information. These future projects include a day-planner and historical ...
2
votes
1answer
139 views

How to identify a PDF classification problem?

We are crawling and downloading lots of companies' PDFs and trying to pick out the ones that are Annual Reports. Such reports can be downloaded from most companies' investor-relations pages. The PDFs ...
1
vote
1answer
208 views

Ruby using the Gosu framework: why it runs slow first time?

I'm creating a Ruby game using the Gosu framework. All good. Sometimes, when I run the game, it has some kind of slow startup, and probably it will be rather slow during the whole game. So I close it ...
1
vote
4answers
241 views

If I use Ruby Migrations, do I have to use the rest of Ruby on Rails?

I'm currently trying to come up with a database migrations strategy for my organization. This includes getting the database scripts into source control, managing versioning, managing releases to QA / ...
0
votes
1answer
160 views

In rails, what defines unit testing as opposed to other kinds of testing [closed]

Initially I thought this was simple: unit testing for models with other testing such as integration for controller and browser testing for views. But more recently I've seen a lot of references to ...
1
vote
1answer
536 views

When to use mixins in Ruby

I am wondering when to use mixins? I have read about them. Many authors compare them to interfaces, abstract classes, etc. Mixins are modules that are mixed-in and modules are a way to group similar ...
-1
votes
1answer
625 views

What is the difference between class level attributes, Class constants and singleton methods?

What the difference given they all exist 'once per class'. When should I use one over another, i.e. for what purpose? I use Ruby.
1
vote
1answer
575 views

rails fake data, considering switch from faker to forgery, any advantages or pitfalls?

With Ruby on Rails I've usually used Forgery for generating dummy data for testing. I've noticed recently that several clients and tutorials are using Faker They both seem fairly similar in use ...
3
votes
1answer
383 views

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 ...
17
votes
4answers
4k views

Return random `list` item by its `weight`

I have, for example, this table +-----------------+ | fruit | weight | +-----------------+ | apple | 4 | | orange | 2 | | lemon | 1 | +-----------------+ I need to return random ...
3
votes
1answer
123 views

Rails solution for mobile-specific content filter?

To note, I'm not interested in simply 'hiding' content for mobile devices, I want to filter out that content completely. I'm also not trying to address the issue by building a mobile specific ...
1
vote
3answers
689 views

Backtracking with Killer Sudoku

I'm developing a Killer Sudoku solver for a school project. I've programmed 10 human strategies showing what they are doing in order to be the most educational possible. It can solve hard Killer ...
1
vote
2answers
340 views

Ruby workflow in Windows

I've done some searching and quite haven't come across the answer I am looking for. I do not think this is a duplicate of this question. I believe Windows could be a suitable development environment ...
1
vote
4answers
133 views

Depend on built technology, or build your own [duplicate]

Possible Duplicate: How to decide between using an existing eCommerce solution and building your own? I am starting a ecomm business and my site idea is pretty similar in functionality to ...
0
votes
2answers
187 views

Where can I find language specific programming standards and style guides?

Is there a good source of best practices, programming standards and coding styles for different languages, specifically Ruby and Javascript?
12
votes
5answers
3k views

Is monkeypatching considered good programming practice?

I've been under impression, that monkeypatching is more in quick and dirty hack category, rather than standard, good programming practice. While I'd used from time to time to fix minor issues with 3rd ...
2
votes
1answer
327 views

Am I experienced enough to learn and develop immediately using Ruby on Rails?

General Question I understand that discussions revolving around questions of this form run the risk of becoming too specific to help others. So, perhaps a better, general question would be: What ...
3
votes
3answers
568 views

Why rails use yaml to config database instead of plain ruby code?

Most of configuration files in ruby such as Gemfile, gemspec, are just ruby code itself. Why database configuration file in rails is the exception?
11
votes
2answers
1k views

How does using a LGPL gem affect my MIT licensed application?

I am developing an open source ruby application under the MIT license. I am using this license because I don't want to place any restrictions on the users of the application. Also I can actually ...
6
votes
1answer
1k views

Ruby Shoes for non-trivial apps [closed]

I've been taking a look at Ruby Shoes for GUI development with Ruby. So far, it's been a pretty good experience for making simple apps. However, I am quite worried about being able to write large ...
0
votes
0answers
187 views

Rails Book Suggestions [duplicate]

Possible Duplicate: Is there a canonical book on Ruby on Rails? I'm looking to learn Ruby on Rails. I already have a small background in Ruby and don't really need a book that covers both, ...
18
votes
3answers
1k views

Moving away from .Net to Ruby and coping without intellisense [closed]

I am in the process of trying to learn Ruby, however after spending nearly 10 years in the MS stack I am struggling to get by without intellisense. I've given RubyMine a try which does help however ...
12
votes
4answers
1k views

What did Ruby do right (or was it Rails)? [closed]

Most programming languages have some design decisions that influence their usage and applicability. For example: Python focused on maintainability/readability of code and had indentation be a part ...
68
votes
9answers
28k views

Why is Python used for high-performance/scientific computing (but Ruby isn't)?

There's a quote from a PyCon 2011 talk that goes: At least in our shop (Argonne National Laboratory) we have three accepted languages for scientific computing. In this order they are C/C++, ...
7
votes
4answers
463 views

I have a bad memory. Is dynamic typing language+vim appropriate for me? [closed]

I am switching from C#+Visual Studio to Ruby+Vim for a few months. The only thing that I am missing from C#/Visual Studio is intellisense, especially when I have a new ruby gem to familiarize. As a ...
1
vote
1answer
816 views

Starting with Ruby on Rails? I see a lot of criticism everywhere. Is it okay to start with Rails now in 2012? [closed]

I have worked on C before and have never tried my hands on any web application creating framework. After some convincing from one of my friends I thought of giving Rails a go. Before starting to work ...
4
votes
2answers
237 views

How to deal with variables when extracting methods in to smaller methods?

This is an abstract question to clarify a refactoring concept in the ruby language. Assume in the real world that there would be many more variables and method in the Furniture Class and Refinish ...
1
vote
4answers
511 views

Should a novice programmer learn several languages at once? [duplicate]

Possible Duplicate: Is it worth being computer languages polyglot? I am half way through my first year at university studying computer science. I have been learning Java on the course and ...
0
votes
1answer
222 views

Client wants to resell the app I programmed [closed]

Not sure if this is the right forum. If it's not, please let me know and I'll move it. So I have been asked by a client to develop a RoR Web App for them. He asked me if the development is their ...
5
votes
3answers
346 views

Generalized VS Specialized technical solution; what to take into account?

We recently had a discussion in the office because of conflicting views between developers. One side (side S) argued technical solutions -generally- need to be a specific as possible, while the other ...
3
votes
2answers
713 views

How to match responses from a server with their corresponding requests?

There is a server that responds to requests on a socket. The client has functions to emit requests and functions to handle responses from the server. The problem is that the request sending function ...
2
votes
2answers
833 views

Ruby Drag-n-Drop IDE and Ruby programming related [closed]

I am writing a small desktop GUI application using Ruby and Gtk2. I am using RubyMine 3 on Linux (Fedora). I created a simple class to create a Gtk Window but now I feel it takes more time to just ...
3
votes
2answers
222 views

Managing constants in application

Our application is having 2 parts a web app running ROR and a web service running Sinatra. The application communicates with the mobile device for which we use different constants depending on the ...
7
votes
3answers
935 views

Help understanding server-side scripting

As far as I understand, there are basically 3 options for doing server-side scripting these days: Using scripting languages that can be directly interpreted/executed by the web server (e.g., PHP and ...