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

1
vote
3answers
253 views

How do I set up pairing email addresses?

Our team uses the Ruby gem hitch to manage pairing. You set it up with a group email address (e.g. dev@mycompany.com) and then tell it who is pairing: $ hitch james tiffany Hitch then sets your Git ...
2
votes
1answer
490 views

Is there a representation for mixins or traits on UML?

Is there a representation for modern programming constructs that are becoming common in modern OOP/hybrid languages like mixins/traits/categories/partial classes ?
0
votes
1answer
150 views

Refactoring this code that produces a reverse-lookup hash from another hash

This code is based on the idea of a Form Object http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/ (see #3 if unfamiliar with the concept). My actual code in ...
1
vote
1answer
239 views

How to build an API on top of an existing Rails app with NodeJs and what architecture to use? [closed]

The explanation I was recently hired by a company that has an old RoR 2.3 application with more than 100k users, a strong SEO strategy with more than 170k indexed urls, native android and ios ...
1
vote
1answer
103 views

Inherit one instance variable from the global scope

I'm using Curses to create a command line GUI with Ruby. Everything's going well, but I have hit a slight snag. I don't think Curses knowledge (esoteric to be fair) is required to answer this ...
2
votes
2answers
2k views

Ruby - when to use instance variables vs parameters between methods?

I'm writing several methods that call other methods. To pass the information I have a couple of choices: Pass the information as parameters Set instance variables so that other methods can access ...
2
votes
1answer
385 views

Rails: Useful example of delegate and Law of Demeter

I am currently learning about delegate and the Law of Demeter. I understand the Law of Demeter, but I can't seem to find a good example of where using delegate to avoid breaking the law would actually ...
4
votes
2answers
537 views

Why does Clojure neglect the uniform access principle?

My background is Ruby, C#, JavaScript and Java. And now I'm learning Clojure. What makes me feel uncomfortable about the later is that idiomatic Clojure seems to neglect the Uniform access principle ...
3
votes
2answers
333 views

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 ...
3
votes
1answer
350 views

What do goroutines, Ruby Fibers, etc. look like to the OS/Kernel?

In process concurrency and thread concurrency it's quite obvious how the kernel sees these as they map directly to real things that the kernel manages. When it comes to Golang goroutines and Ruby ...
0
votes
1answer
576 views

Use ruby's array sort() method, or add items in correct place with a binary lookup?

If I am loading a whole load of items (un-ordered words from a file or something) would it be more efficient to load them all to a Ruby array, and then use the built in sort! method or to do a binary ...
2
votes
1answer
202 views

Designing and refactoring of payment logic [closed]

Im currently working on an application that helps users to coordinate dinner clubs and all related accounting. (A dinner club is where people in a group, take turns to cook for the rest and then you ...
8
votes
1answer
4k views

Why did Microsoft abandon IronRuby and IronPython? [closed]

Several years ago, Microsoft announced that Ruby and Python were coming to .net. The projects were called IronRuby and IronPython, respectively. Microsoft said that the projects would be built on ...
1
vote
4answers
203 views

Until what point should I refactor? [duplicate]

What do you think until what point should a programmer refactor the code? Basically having def method do_something end Pieces of code would be handy, but they increase spaghetti code until the ...
4
votes
3answers
1k views

How can web development bootcamps deliver on their promise? [closed]

I came across the concept of web development bootcamps, these 9-10 week intensive crash courses claim to teach beginners web development and help them get 80k starting salary jobs. Many of you might ...
2
votes
1answer
116 views

Storing different algorithms and using them for demonstration

I have an app for creating simple graphs (the kind with vertices and edges) and then using different algorithms on them (BFS, DFS, topsort, Prim's etc) for demonstrating how they work. I'm now ...
2
votes
2answers
97 views

Should I put the datatype of a class attribute in its name?

Most of my system's class attributes are just text, but in this case it makes more sense to place this particular class's attributes into one single hash (from a "keep the source code pretty" aspect). ...
7
votes
2answers
829 views

Is it considered bad practice to compile into Javascript as a matter of language preference? [closed]

I understand that compiling into Javascript is sometimes necessary and even in some cases results in a faster application. However I'm wondering if compiling into Javascript, for building web ...
1
vote
4answers
202 views

Efficient way of evaluating an array of strings then add to an array in Ruby

I am looking for an efficient way of evaluating an array of strings against a series of rules and then adding them to another array. For example I have an array of strings: something a 1234 #gohere ...
1
vote
2answers
431 views

Ruby: Multithreading a CSV with output

I have a script written in Ruby that has maxed out a core in my server's Xeon processor for the last 2 hours. Since it's currently only using 1 of four possible cores, I want to try and rewrite the ...
2
votes
2answers
10k views

What should I learn to be backend web developer? [closed]

I want to be a web developer and because I don't want to get into designing (and stuff like that) so I thought I should become a backend developer (also more suited because of my course i.e. b.tech in ...
2
votes
3answers
563 views

What to use in UML for included module in ruby?

I like to create simple class diagrams for my projects. Most of the time I just use composition, inheritence and associations. IMB's basic UML resource tells all about this. However I'm using ruby so ...
3
votes
1answer
277 views

How do I test this?

I've attempted test first in Ruby on Rails using Test Unit and RSpec. I'm wondering how to do test first in situations that are more closely tied to the OS/filesystem. Problem: Building a USB stick ...
2
votes
3answers
452 views

Is the Observer pattern adequate for this kind of scenario?

I'm creating a simple game development framework with Ruby. There is a node system. A node is a game entity, and it has position. It can have children nodes (and one parent node). Children are always ...
6
votes
3answers
298 views

Is there any situation in which it would be appropriate to use unless… else?

This construction is considered wrong unless #.. else #.. end This is for the general reason of double-negative confusions. It translates to: if not #.. if not not #.. end We all agree ...
1
vote
1answer
478 views

ruby-idiomatic hashes vs arrays

So I am still fairly new to ruby, though I have noticed that it is very hard to create 2d-array and that hashes seem to be more of the go to data structure than arrays. I was wondering why the Ruby ...
2
votes
1answer
137 views

How do I know when should I package my classes in Ruby?

In Ruby, I'm creating a small game development framework. Just some personal project - a very small group of friends helping. Now I am in need of handling geometric concepts. Rectangles, Circles, ...
0
votes
1answer
235 views

Algorithms for Data Redundancy and Failover for distributed storage system?

I'm building a distributed storage system that works with different storage sizes. For instance, my storage devices have sizes of 50GB, 70GB, 150GB, 250GB, 1000GB, 5 storage systems in one system. My ...
-2
votes
4answers
2k views

What can I do with Ruby beside RoR? [closed]

Beside RoR, what do people use Ruby for? Is there any use for Ruby on Windows platform? If you use ruby for scripting why not use Bash or Powershell?
7
votes
2answers
254 views

How to share control of links/domains on an open source project with many collaborators?

I'm trying to help the Rebol project re-engineer its web presence now that it is open source as Apache 2 — after nearly two decades of proprietary license! The language's creator currently has ...
0
votes
0answers
109 views

How do I test my non-Ruby website using Ruby?

I would like to build some Ruby tests to test my non-Ruby website. I love the Ruby testing tools (webrat, capybara, etc.) but they seem to be targeted to testing local sites. How can I use these ...
2
votes
1answer
153 views

How do I distinguish between things belonging to the standard library, specific gems, and those that are user-generated in Ruby?

I'm a beginning programmer, that for various reasons is using an existing Ruby codebase to learn to program. My goal is to be able to understand and eventually extend this codebase. However, I find it ...
0
votes
2answers
172 views

Why there is much more support for closed xls format in rails (and ruby) than to an open ods format?

It is little depressive, but it seems to me that there is much more support for manipulating ugly proprietary closed format like xls in rails (and ruby) in general that to documented open Open ...
0
votes
1answer
346 views

Benefits of using XML builder vs templating language like ERB?

I'm doing a lot of work with XML, our legacy XML generators use the ruby template language ERB to create the XML files. I've been experimenting with Nokogiri and the builder model of creating XML, but ...
4
votes
1answer
165 views

Order collisions in ecommerce

Suppose I have a web app where sellers add their products and set them as available for sale. Then I show a list of products in my mobile app, where I get products via my REST API. My problem: suppose ...
0
votes
3answers
661 views

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" ...
3
votes
2answers
332 views

Getting practicality of PHP from Ruby or Python

I have a rather odd problem. I love the practicality of PHP - specifically that I can fairly safely assume that on any random server I'll have access to the MySQL libraries, and that I can go between ...
1
vote
1answer
3k views

Why does gmail use java? Is there really a advantage over something like php or python? [closed]

Note: I know that none of you (probably) work for google, so this is a lot more of a conceptual question. So yeah, i discovered that Gmail uses java and that got me thinking, Why? I personally never ...
1
vote
3answers
367 views

Is there any situation when there's no alternative to instanceof?

It seems to me that instanceof comes from the land of functional programming and is a watered down version of pattern matching and that the OO altenative to it should be dynamic dispatching. In OO ...
3
votes
1answer
485 views

Is it possible to write a code without class methods, globals, and class variables? [closed]

I'm designing my own programming language for fun, and I'm thinking of making it fully Object-oriented (no statics, no globals, no class variables, no class methods), so I need to find a way to ...
2
votes
1answer
320 views

How does dependency inversion principle work in languages without interfaces?

In C#/Java, the dependency inversion principle is often demonstrated by high-level classes that depends on an interface/abstraction (that it owns). Low-level classes will implement the interface, thus ...
2
votes
1answer
267 views

Attempt at understanding the double-dispatch pattern

I've been trying to grok the double-dispatch pattern and having a hard time. I finally attempted a sample program to help myself understand. Here's the gist. But then I decided to attempt it without ...
0
votes
1answer
288 views

Online stores service design

I am designing an online store service app with rails. Everyone who wants to make his/her own store can do it with this app by just signing up and choosing a domain. I want to make it as SaaS as it ...
8
votes
3answers
408 views

Is Non-Deterministic Resource-Management a Leaky Abstraction?

From what I can see, there are two pervasive forms of resource-management: deterministic destruction and explicit. Examples of the former would be C++ destructors and smart pointers or Perl's DESTROY ...
1
vote
1answer
211 views

Should an open source gem contain .rvmrc?

Using .rvmrc seems to be considered a best practice for apps. But should an open source gem contain .rvmrc in their source code on Github? I think it's not good to require everyone who wants to ...
2
votes
1answer
459 views

Ruby manager for Windows: Is Ruby's PIK alive or dying?

At first, please forgive probably offtopic and/or notconstructive question, but I truly have no idea where to ask it. At first I targetted StackOverflow there's at least some PIK-related traffic ...
1
vote
1answer
140 views

Building an RPC framework

I'm curious about what it takes to build a simple and robust RPC framework. I've only looked at a few ruby frameworks but they are all lacking in some way. What I want out of an RPC framework is some ...
2
votes
1answer
418 views

When can one call themselves a “Rubyist”? [closed]

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"?
19
votes
5answers
1k views

How to avoid giant glue methods?

In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, ...
4
votes
3answers
257 views

Is there an idiom for a loop that executes some block of instructions between iterations? (In Ruby in particular)

I often need to do some operations in a loop and some other operations between the iterations. A simple example would be collecting words from an array into a string, spelled backwards and separated ...