M
Mikel Lindsaar
[Note: parts of this message were removed to make it a legal post.]
What is the cleanest way of doing:
def initialize(value)
begin
if value == 'blah'
a_action
else
b_action
end
rescue
b_action
end
end
That is. If a is needed and doing a throws an exception, do b instead.
Otherwise, if a is not needed do b.
Or is that the cleanest way?
By cleanest, I mean l don't like calling b_action twice in the method if I
don't have to, but it's a trade off on readability... and I don't _like_ the
way the code looks now
Any other simpler way to do this pattern?
Mikel
What is the cleanest way of doing:
def initialize(value)
begin
if value == 'blah'
a_action
else
b_action
end
rescue
b_action
end
end
That is. If a is needed and doing a throws an exception, do b instead.
Otherwise, if a is not needed do b.
Or is that the cleanest way?
By cleanest, I mean l don't like calling b_action twice in the method if I
don't have to, but it's a trade off on readability... and I don't _like_ the
way the code looks now
Any other simpler way to do this pattern?
Mikel