J
John Maclean
=begin
Hey chaps,
Is it bad practice to have nested methods? I'm sure that it would
result in messey/cluttered code. Does any one actually code like that
at all? Not really -essential- as everything is working, (even better
than), as expected without nested methods. Just would be nice to know
what the gurus andmy peers think on this one.
- jjm
=end
class Foo
def initialize(this, that, the_other)
@this = this
..
end
def method_1?
# here I check for some criteria
if %x[some_command] == "some criteria"
@this = true
end
# every other method from here on depends on @this == true. Would be nice to be able to skip the remained of the code if @this != true
def method_2
# do all of this stuff if @this = true
end
Hey chaps,
Is it bad practice to have nested methods? I'm sure that it would
result in messey/cluttered code. Does any one actually code like that
at all? Not really -essential- as everything is working, (even better
than), as expected without nested methods. Just would be nice to know
what the gurus andmy peers think on this one.
- jjm
=end
class Foo
def initialize(this, that, the_other)
@this = this
..
end
def method_1?
# here I check for some criteria
if %x[some_command] == "some criteria"
@this = true
end
# every other method from here on depends on @this == true. Would be nice to be able to skip the remained of the code if @this != true
def method_2
# do all of this stuff if @this = true
end