All Questions
Tagged with ruby converting
16 questions
1
vote
1
answer
117
views
Filter to convert duration to hours — in controller or model?
I have this before_action method :
...
4
votes
1
answer
101
views
Brainf**k to Ruby interpreter -- v3
Previous iteration.
I think this is about as good as it's gonna get, but just for kicks, let's do one more round of iterations.
As before, it's a very simple substitution from Brainfuck to Ruby, ...
8
votes
1
answer
169
views
Brainf**k to Ruby converter -- v2
Previous iteration.
You know, I think this is the fastest I've ever pushed out an update to anything. This is Version 2 of my Brainf**k to Ruby converter, and the generated code looks... Well, like ...
7
votes
2
answers
462
views
Brainf**k to Ruby converter, written in Ruby -- v1.0
I've seen a lot of Brainf**k interpreters in various languages. I decided that actually interpreting Brainf**k is too hard, so instead of that, I wrote a 'compiler' in Ruby that directly transcribes ...
2
votes
0
answers
2k
views
PDF-to-JSON converter
I've created some methods to help me convert PDF to text and then text to a JSON object. I've never done this before and I'm using this exercise as a way to improve my knowledge of Ruby.
The ...
2
votes
1
answer
1k
views
Binary convert to string in Ruby
This was a challenge for reddit #202 Easy /u/learnprogramming ...I wish that someone reviews my code and let me know your opinion about my way of thinking beacause I am a total beginner in Ruby:
<...
10
votes
1
answer
887
views
Spell a given number in English
I wrote a program that will take a number from 0 to 999,999,999,999 and spell out that number in English.
How could I improve the readability of my code?
...
5
votes
2
answers
218
views
Convert cardinal abbreviations into full cardinal direction
I'm still learning Ruby and I made the following function to convert "N" or "SE" into "NORTH"...
9
votes
5
answers
2k
views
Convert total minutes into "Hours:minute:seconds" for marathon data
The point of the script below is to read in the 10th column which is the total number of minutes a runner took to finish the marathon and convert it into form of "hours:minutes:seconds". Is there a ...
7
votes
1
answer
780
views
Binary converter and sufficient tests
I just finished writing a basic binary conversion class in Ruby. I'm curious to see if anyone has suggestions for improvements. In particular, I'm looking for the cleanest, shortest, most succinct ...
6
votes
1
answer
6k
views
Converting between Fahrenheit and Celsius
I'm learning Ruby and working through some exercises. I completed the following exercise without truly understanding why and how it works. I know that's an embarrassing thing to say but I feel like my ...
5
votes
3
answers
2k
views
Number to words problem
This is a very long solution I've been working on to a Number to Words problem. I've identified that there's a lot of repeating logic (e.g. 'if writing > 0', 'writing = integer /',).
How would you ...
4
votes
2
answers
2k
views
Roman numeral converter in Ruby
For a Project Euler problem, I made a Ruby roman numeral converter:
...
3
votes
2
answers
166
views
Date and time columns conversion to Time(WithZone)
I have two columns representing a date and a time.
{dateproc: '2012-03-23', horproc: '2000-01-01 16:15:23 UTC'}
Both are read as a ...
4
votes
4
answers
2k
views
Temperature converter that seems to violate SRP
I've written this class for two purposes (I think only this fact shows that this code violates SRP): convert weight from one unit to another and to represent them accurate or not accurate. So class ...