J
Jason Burgett
I'm trying to exit a running method after a certain condition is met. I
have a master method executing sever methods within the same class.
Example:
def self.method_1(user)
words = ["hello", "goodbye", "bonjour"]
user.strings.each do |string|
words.each do |word|
if string.text.downcase.include? word.downcase
puts "I found #{word}"
end
end
end
end
def self.method_2
put "This is method 2"
end
In the above example, how do I stop execution on [method_1] after [puts
"I found #{word}"] so it can continue on to [method_2]?
have a master method executing sever methods within the same class.
Example:
def self.method_1(user)
words = ["hello", "goodbye", "bonjour"]
user.strings.each do |string|
words.each do |word|
if string.text.downcase.include? word.downcase
puts "I found #{word}"
end
end
end
end
def self.method_2
put "This is method 2"
end
In the above example, how do I stop execution on [method_1] after [puts
"I found #{word}"] so it can continue on to [method_2]?