Questions tagged [Ruby] (1569)

1
answer

How to cut a regular expression?

html_content = "<div style=\"padding: 0;\"> <blockquote><span edit=\"false\">test</span></blockquote> </div>" html_content.gsub!("<span edit=\"false\">", ") html_content.gsub!(/<\/span><\/blockquote>/i, "</blockquote>") html_content.gsub!(/blockquote>/i, "bloc...
Bernita asked April 19th 20 at 12:07
1
answer

How to count the number of elements in the string in ruby?

There is a line like this f = '1232132131, 12321321, 34232423423, 324234234234'You need to count the number of elements. I know that for a list of words works here f.split(/[^-a-zA-Z]/).size How to convert it into a variant with numbers, maybe there is an easier way?
Gertrude asked April 18th 20 at 13:21
1
answer

How to do that would calculator was the chain? How to enter code in stacks? How to withdraw the last Prime number?

you need be able to chain actions ie 2 + 2 4 + 5 9 and so on, and the work stack (container first came in - last out), and that the calculator could display the last Prime number (and write it in the stack) Calculator has started 3 primes 10 7 // prints the last Prime number, all the number of writes in the stack po...
Adell_Kutch asked April 18th 20 at 12:52
1
answer

How to add support for unary operations in ruby calculator?

there's a calculator: --, sqrt, sin, cos, tan, ctan, exp, ln, ! that would be considered? on request output sin sine, and so on. I at least just an example, I will do the rest. Thank you very much in advance. how to add in this support # chain calculator while true do puts "Calculator has started" print 'Type numbe...
Branson_Weissn asked April 18th 20 at 12:45
0
answer

The underlying code in Sinatra?

Can you please explain each line of this code in Sinatra: require 'sinatra' get '/' do 'Hello world!' end
Thurman.Lehner asked April 18th 20 at 12:13
0
answer

An example of a large site on Sinatra and the stack of used technologies?

An example of any large site written in Sinatra framework and a stack of used technologies
Vivianne asked April 18th 20 at 12:12
1
answer

How to copy object in this case?

Type of object to copyobj = { id: 1 models: [ { id: 1, parent_id: nil }, { id: 2, parent_id: 1 }, { id: 3, parent_id: 1 }, { id: 4, parent_id: nil }, { id: 5, parent_id: 4 }, { id: 6, parent_id: 4 } ] } The object exists of this type. praent_id is the ID of the same model which is nil. When you copy it using th...
Danial_Treutel96 asked April 16th 20 at 10:45
1
answer

How to quickly display LARGE amounts of data to STDOUT in Ruby?

Good time of day. The challenge is that the STDOUT of hundreds of millions of rows. Your code runs in a Docker container with 2 cores and 4 GB operativki. Ruby 2.7.0 Now pseudoceratina: There are several files ( each from 2 000 000 to 3 000 000 rows) that are read line by line, each line is displayed from 10000 to 150000 t...
emerson66 asked April 16th 20 at 10:03
1
answer

How to do the replacement in the text with regexps in ruby?

There is a text string, in which is found an excuse my I have offer this as an excuse to replace me, but if for example the word will meet this sequence of letters inside the words did not need to change, only self-standing preposition, how could it be done?
denis37 asked April 9th 20 at 10:36
2
answers

How to implement SSL certificate for the domain?

Hello, how can having the domains to find out information about their certificates, well and accordingly the test is expired or not and other SSL errors. Verification should be carried out without a third party API and services. You can use openSSL. Can "poke" where to draw resources ?
Janiya asked April 8th 20 at 10:35