Hi,
i am struggling to understand binding concepts, i am not able to find
good doc which can help me to understand or not able to find matching
doc with the code i am looking at … please help me to understand it
with some examples …
def self.required_params(local_names, binding, keys_to_remove=[])
local_names = local_names.reduce({}) do |acc, v|
value = binding.eval(v.to_s) unless v == :_
acc[v] = value unless value.nil?
acc
end
#The double delete is to support 1.8.7 and 1.9.3
local_names.delete(:payload)
local_names.delete(:optional)
local_names.delete("payload")
local_names.delete("optional")
keys_to_remove.each do |key|
local_names.delete(key)
local_names.delete(key.to_sym)
end
return local_names
end
… How binding works in above example … what i really want to
understand is below method … or some example i can relate with …
def self.required_params(local_names, binding, keys_to_remove=[])
local_names = local_names.reduce({}) do |acc, v|
value = binding.eval(v.to_s) unless v == :_
acc[v] = value unless value.nil?
acc
end
Regars,
DJ
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.