P
Patrick Doyle
[Note: parts of this message were removed to make it a legal post.]
Is there a cleaner, more Rubyesque way to do this?
# Return a hash of the navigation parameters
def nav_params
params = {}
params[refix] = @prefix if @prefix
params[:category_id] = @category_id if @category_id
params[age] = @page if @page
params
end
I want to load a parameters hash with the contents of some instance
variables, but only if they are defined.
--wpd
Is there a cleaner, more Rubyesque way to do this?
# Return a hash of the navigation parameters
def nav_params
params = {}
params[refix] = @prefix if @prefix
params[:category_id] = @category_id if @category_id
params[age] = @page if @page
params
end
I want to load a parameters hash with the contents of some instance
variables, but only if they are defined.
--wpd