Tagged Questions
1
vote
2answers
193 views
Tic-Tac-Toe implementation where computer should not lose
I have implemented Tic-Tac-Toe so that human can play with the computer, where the computer should never lose. I did a simple analysis before implementing, and I found out that there are certain ...
10
votes
2answers
116 views
How can this Ruby format analyser be improved?
I have a requirement to validate file names related to architecture after they are uploaded. Once they have been uploaded I must warn the user if the file name is not standards compliant.
What's in a ...
4
votes
2answers
89 views
Ruby Dynamic Struct - Pattern or AntiPattern?
There is a pattern that keeps coming up in my ruby code and I'm somewhat ambivalent about it. It's somewhere between a Hash and a Struct. Basically
I used method_missing to return/set values in the ...
3
votes
0answers
86 views
Encapsulating behavior spread across multiple event handlers
I wrote a chatbot in Ruby for turntable.fm, a chatroom where users can listen to music together. It interacts with users in a room, who can type in specific keywords and get responses from it. It also ...
0
votes
2answers
306 views
A flexible Ruby Observable module
I was learning a bit about about observers. Ruby has an Observable module, but I decided to make my own with a few tweaks.
The first important feature is that this ...
2
votes
1answer
117 views
How can I refactor Api::SessionsController?
I have session controller for mobile devices. I would like to refactor it a little, for example because my session controller is sub class of ...
5
votes
1answer
395 views
Is this an appropriate class design for the strategy pattern in Ruby?
I am fairly satisfied with my solution here but I would definitely appreciate any constructive criticism of my style and design. The basic idea is to use the strategy pattern to simplify assembling a ...