rubymine column selection mode select few lines [closed] - ruby

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm trying to edit in column selection mode on Rubymine but I have some lines I wish to skip.
In the code below I would like to edit both "to_change" at the same time.
I wish to duplicate the cursor and every edit action will occur in them both.
In this code if I will select the start of both "to_change" and press '#', the code here:
def a
to_change
end
def b
to_change
end
will turn to
def a
#to_change
end
def b
#to_change
end

Multiple selection/editing is not supported yet, you can follow this feature request.

Related

Plis I wish indications a site to train automated software testing [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
describe 'Visit script' do
it 'visitar a pagina' do
puts "visitando a pagina"
visit "https://www.google.com/"
expect(page.title).to eql "Google"
end
Don't use the standard RSpec matchers with Capybara objects - the standard matchers don't have waiting/retrying behavior. Instead use the Capybara provided matchers
it 'visitar a pagina' do
puts "visitando a pagina"
visit "https://www.google.com/"
expect(page).to have_title("Google")
end

Inhibiting repetition with user input [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need a code that collects a user's input with gets.chomp, and if they repeat the same answer twice, it will read an error message. What is the best method to do this? Is there a way to collect the answers and then continue to check for duplicates?
Keep an history of answers.
history = []
loop do
answer = gets.chomp
if history.include? answer
puts "already answered"
next
else
history.push answer
end
# do something
end

How to write a file in ruby without a terminating newline [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
For debugging purposes, I want to alter a rake test so as not to end a saved file with a newline.
I don't know ruby. How do I do this? (file.print doesn't seem to work.)
Not clear what you are doing, but since you tried file.print, it looks like you have access to what is to be printed. Let's say this is string. My guess is that string already has a newline character. Then do:
file.print(string.chomp)

How to split the first and the last element on a Ruby string? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to split a string in 2 parts: the first word and the last one.
I know I need to use the .split method but don't know how.
Is this what you want to do?
first, *_, last = "now is the time for all".split
first #=> "now"
last #=> "all"

Ruby 1.9, return array if keys include a particular object [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Code:
#albums = #genres.each_with_index { |item,key|
if item.keys.include?('Albums')
break
end
}
This should be returning the Albums array (the #genres object is a huge multidimensional JSON response)
I reckon this is what I get for trying to code while being sick... or just simply doing things wrong... either way, any help is much appreciated!
I think you want #detect (or its synonym #find):
#albums = #genres.detect { |item| item.key?('Albums') }['Albums']
EDIT | Also note that you can provide an argument to break just like you can do with return, if you want to break and return a specific value.

Resources