Questions tagged as 'ruby'

0
answers

how to collect retweets and replys from a user in ruby

I'm doing a job and in it I need to collect the number of retweets and replys from 10 tweets from a Twitter user. In the code it is already possible to collect the number of followers and following by users and I have made an attempt to collect...
asked by 24.06.2015 / 00:57
2
answers

Ruby - comparison of values between a range or greater than, less than

I'm starting to study programming so, it's a very beginner question. I tested below to learn about case in Ruby , current_time = ARGV.first.to_i case current_time when 0..45 then puts('First Haf') when 46..90 then puts('Second Haf'...
asked by 19.02.2018 / 19:37
3
answers

Delete the .bashrc, .bash_profile, and .profile files: what are the consequences?

I've been trying to install Ruby and Ruby on Rails through RVM but during the installation process I had some problems. I tried to uninstall RVM through the commands: rvm implode gem uninstall rvm After performing these commands, I...
asked by 27.02.2014 / 23:06
2
answers

Two-dimensional array in Ruby

I have the two-dimensional array a = [[1,'a'],[1,'b'],[2,'c'],[2,'d'],[3,'e'],[3,'f'],[4,'g'],[4,'h']] I want to separate the letters in another array b so that it looks like this: [["a","b"], ["c", "d"], ["e", "f"], ["g", "h"]] Wher...
asked by 21.05.2014 / 03:54
3
answers

Correct test for model (RSpec)

I created a test to validate my model and want to know if it is correct. describe Article do it "object article create is valid?" do article = Article.create article.title = "Title for Test" article.description = ""...
asked by 30.01.2014 / 14:50
1
answer

Doubt about using send () in ruby

The general idea of OO is that each object can react differently to the same message. In ruby, I noticed that it is possible to use the send () method and that every object in Ruby has this method. So, I can do something like: object.send (:...
asked by 11.10.2015 / 22:20
1
answer

Doubt regarding the || = operator of ruby

Hello I'm still starting in ruby, and I have a question regarding the following code Main.rb web_design = Livro.new "Ruby", "X", "9428", 56.40, :web_design android_dev = Livro.new "Java", "Y", "9385", 78.9, :android_dev game_dev = Livro.new...
asked by 21.07.2016 / 23:24
2
answers

Identify elements that are repeated within a two-dimensional array

In an array a = [[1,"José"],[2,"Pedro"],[3,"Maria"],[4,"Lauro"],[2,"Pedro"], [5,"Léo"],[1,"José"],[6,"Caio"]] How to get a new array b that shows the positions of the indexes with the arrays that repeat (equals) ?, in this case array b...
asked by 09.06.2014 / 11:28
2
answers

Extra fields do not save with Devise

I'm new to rails and I'm trying to implement Devise with some extra fields. It is saving the email and password correctly, but my first_name and last_name fields are not being saved. It is nil This is my view of the regis...
asked by 04.06.2014 / 02:17
1
answer

How to call a script with arguments?

I'm a little overweight, and searching on Physical Fitness , I figured out how to calculate my caloric expenditure through heart rate. So I created the following script: bpm = 150 massa = 70 idade = 20 # hahaha tempo = 30 sexo = 'm' def c...
asked by 24.06.2017 / 01:17