Answer the question
In order to leave comments, you need to log in
I want my own return_my in Ruby. How to do it?
For example, how to do something like this:
module RootRouter
def route
obj = SlaveClass.new()
#....
return obj.one if something
return obj.two if something_else
return obj.thr if something_else_another
#....
end
end
class SlaveClass
def initialize
@obj = ActionClass.new()
end
def one method
#do something
#...
@obj.some_method
#do something
#...
#do something
#...
return 'no response'
end
def two method
end
def thr method
end
end
class ActionClass
def some_method
#do something
#...
return_my 'some variable some_method' if example_false_value
puts 'all ok we continue here'
#do something
#...
return 'any text for return'
end
def second_method
#do something
#...
return_my 'some variable second_method' if example_false_value
puts 'all ok we continue here'
#do something
#...
return 'any text for return'
end
end
Answer the question
In order to leave comments, you need to log in
Artyom Petrenkov : Options for that and options to float up. And yes, begin ... rescue ... end blocks can be nested.
Thanks Artem!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question