Method: Nitro::Cgi.structure_param
- Defined in:
- lib/nitro/cgi.rb
.structure_param(params, key, val) ⇒ Object
push a parameter into the params hash
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/nitro/cgi.rb', line 79 def self.structure_param(params, key, val) if key =~ /(.+)\[(.+)\]$/ or key =~ /([^\.]+)\.(.+)$/ params[$1] ||= Dictionary.new params[$1] = structure_param(params[$1], $2, val) elsif key =~ /(.+)\[\]$/ params[$1] ||= Array.new params[$1] << val.to_s else params[key] = val.nil? ? nil : val end return params end |