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

0
votes
0answers
26 views

How would you rate different website based on their content [on hold]

I'm the author of a ruby gem called LinkThumbnailer which basically allow you to generate website thumbnails given an URL. It fetches the images, title and more importantly a description that is ...
-1
votes
0answers
19 views

RoR - Cleaner way to stop nil errors

Not that this is awful, but is there a better way to do the below? (post.content || "").html_safe
-4
votes
1answer
106 views

Is there a purely technical term for 'monkey patching' [closed]

EDIT The original title of the question was Is there a non-derogatory term for 'monkey patching'. As I have learned that the term is actually not derogatory, or is at least not meant to be, I changed ...
0
votes
1answer
37 views

JSON - Ruby objects key naming

Ruby object has method/property: def tentakles_count 8 end JavaScript object has key/property: { justEnough: true } Now, when JavaScript gets serialised ruby object via XHR or WebSocket, ...
0
votes
0answers
33 views

Ruby on Rails - branding

I am working on a website, which is to have multiple brands. The core functionality for all brands will be the same, however there will be a number of differences between them. Those differences may ...
0
votes
3answers
127 views

Need advice on design in Ruby On Rails

For personal educational purposes I am making a site for a conference. One of the object that exist in a conference is a session, which has different states and in each state it has slightly different ...
0
votes
0answers
60 views

why many ruby gems won't work on windows

Most of the gems out there work fine on *nix but not on windows. First I tried mysql2, then dosu which shows incompatibility with ruby 2.0. I tried things on github issues, but no luck. I never had ...
2
votes
2answers
107 views

How to check robustness in a service that includes multiple points of failure in workflow, including FTP

As part of my workflow, I need to do all these steps in one transaction - I need to ftp files to 2 different FTP servers. - There is also a spreadsheet that gets generated which needs to be FTP'ed. ...
2
votes
4answers
165 views

Test Doubles, Mocks and Stubs - when not to use & why, for Ruby, Rspec

I've learned about mocking and stubbing and I've seen how they can help me create great test suites that run blindingly fast and thus speed up my development process hugely. However I've also seen ...
-2
votes
1answer
821 views

Advantages and disadvantages of PHP/Ruby [closed]

I've been a front-end developer for about two years now, and I'm attempting to break into the server side of things. Ideally I'd like to work for a startup social network on the back-end side so I ...
1
vote
2answers
44 views

Auxiliary space complexity of map vs map!

I'm curious about the difference in space complexity between map and map! in ruby. If I have the methods: def mult_by_two(arr) arr.map {|i| i * 2 } end def mult_by_two!(arr) arr.map! {|i| i * 2 ...
32
votes
11answers
4k views

Is it okay to make coding style changes on an open source project that doesn't follow best practices?

Recently, I came across a number of open source Ruby (or majority of it was Ruby) projects on GitHub that when checked with a code analyzing tool like Rubocop, create a lot of offenses. Now, most of ...
2
votes
1answer
65 views

scoping concern when dealing with coupling

I'm learning ruby (and OOP in the process) and I find keep having to write the same patterns when logging progress so I want to wrap this up in a logging library that my other code can then just pass ...
0
votes
6answers
165 views

How do I explain a ruby method with a real-world analogy?

I am looking for a good analogy to help the concept of a method in ruby stick in my head. When I truly understand a concept, an image flashes in my mind that relates something physical to the abstract ...
0
votes
0answers
105 views

Ruby module namespacing advice

in my current project have: module Stats class Site ... end class Product def initialize(product_id) @product_id = product_id end end class Profile ... end end ...
1
vote
1answer
159 views

Dealing with 'dirty' Ruby on Rails client

I had to leave a startup about a month ago because of lack of funding. Basically, this client wanted an application to allow contractors to create, update, read, and delete yardsigns. Straight forward ...
1
vote
2answers
69 views

In Ruby, change global in thread safe block

In Ruby, I have a use case for a few common configuration options, e.g. NOOP, TRACE, SILENT. Right now I am using local vars instead of globals and passing them around all over the place and it's a ...
0
votes
1answer
142 views

ruby for desktop app or web app development [closed]

i am a beginner to ruby . i just did some minor research about why RUBY ? why choose RUBY ? whats new in it. Whenever i do type in a word RUBY in google search there comes a suggestion like RUBY on ...
18
votes
3answers
993 views

Why do so many languages treat numbers starting with 0 as octal?

I've read Where are octals useful? and it seems like octals are something that were once upon a time useful. Many languages treat numbers preceding with a 0 as octal, so the literal 010 is actually ...
2
votes
1answer
108 views

How to create html pages which don't change very much and not very often?

I have a Rails server that connects to a json API on another server to get data to build the pages dynamically. These pages, however, don't change very much and not very often. I was thinking I could ...
1
vote
0answers
28 views

Should I refactor a F class from code climate? [duplicate]

According to code climate, a class is F, aka the worst mark you could be granted. I did submit a pull request to rearrange it here Which has been refused because the new code is supposedly too ...
1
vote
1answer
58 views

Should I use the new method/action to retrieve records? (Rails)

I have an admin controller that is just used for its index action which renders a view with the most recent updates to certain resources: class AdminController < ApplicationController ...
-1
votes
2answers
152 views

Programming beginner: Options for small program interfaces? [closed]

I have been a Rails developer for a year now, and I really want to start diving in to Ruby and pure programming without using a framework. However I am having trouble conceptualizing little programs I ...
2
votes
3answers
155 views

Is there a reason for the crossover from the Ruby community to the Clojure Community?

When we look at the the overlap between the Ruby Community - we see the following overlaps: Think Relevance (now Cognitect) has switched from Ruby to Clojure Jay Fields has switched from Ruby to ...
0
votes
2answers
168 views

help me understand Rails and attributes as class methods

This is from the Hartl Rails tutorial. We are automatically logging in a user in the process of creating that user with a callback to #create_remember_token. It works great but there are some things, ...
4
votes
2answers
252 views

Is using static-typing the solution to domain-driven design and decreasing the number of errors?

We are using PHP (a dynamically-typed language) in our project. However, I have found my colleagues asking questions such as ...
1
vote
3answers
202 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
245 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
116 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
183 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
84 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
856 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
213 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 ...
3
votes
2answers
325 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
280 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 ...
0
votes
0answers
129 views

What is the best procedure to setup real-time data transfers with Redis?

I have setup a RESTful API using Ruby on Rails for an iPhone application.There are some instances, however, that I would like to use Real-Time Pub/Sub data-transfers, I have drawn up 2 potentials: ...
3
votes
1answer
253 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
276 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
191 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 ...
6
votes
1answer
2k 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
198 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 ...
3
votes
2answers
778 views

How can web development bootcamps deliver on their promise?

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 ...
0
votes
0answers
94 views

Ruby Capybara HTML DOM Issue

I am trying to get the links from Google adverts that appear in a webpage in programmatic manner. I have been testing Ruby and Capybara but I have an issue where the DOM as stated by Capybara is not ...
2
votes
1answer
112 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
88 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). ...
6
votes
2answers
533 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
149 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
293 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
4k 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 ...
1
vote
3answers
332 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 ...