P
Pito Salas
Hi,
I seem to be repeating myself in the following little bit:
if (!@options[:namespace].nil?)
namespace_options = @options[:namespace]
root.add_namespace(namespace_options[:namespace],
namespace_options[:value])
end
Can someone show me a way to not repeat options[:namespace] ?
Simpler example of the exact same:
if (!hash[:value].nil?)
h = hash[:value]
puts h[:left], h[:right]
end
Thanks for any tips for writing more idiomatic ruby!
I seem to be repeating myself in the following little bit:
if (!@options[:namespace].nil?)
namespace_options = @options[:namespace]
root.add_namespace(namespace_options[:namespace],
namespace_options[:value])
end
Can someone show me a way to not repeat options[:namespace] ?
Simpler example of the exact same:
if (!hash[:value].nil?)
h = hash[:value]
puts h[:left], h[:right]
end
Thanks for any tips for writing more idiomatic ruby!