About define significance variable(in this situation)

def method_1(options ={})
if some_conditions
options = {:method_2 => true}
method_2(options)
end

method_3(options)
method_4(options)
end

def method_2(options ={})

some code

end

method_1({:method_1 => true)

+++++++++++++++++++++++

in some_condition, the variable options is most significant, but we use
temporary variable name options, it would rewrite options in method_1.
what would you do to name this variable?

t_options?
temorary_options?

On 04/02/2010 10:01 AM, Zhenning G. wrote:

def method_2(options ={})
what would you do to name this variable?

t_options?
temorary_options?

I would not name it at all.

def method_1(options ={})
if some_conditions
method_2(:method_2 => true)
end

method_3(options)
method_4(options)
end

Btw, I have a nagging feeling that what you are doing might not be such
a good idea. But since we do not have any more context that’s difficult
to substantiate.

Kind regards

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs