Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/left_side/core_ext.rb
Instance Method Summary collapse
Instance Method Details
#get_params ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/left_side/core_ext.rb', line 2 def get_params params_str = self.split("?")[1] return {} unless params_str params_str.split('&').inject({}) do |hash, str| arr = str.split('=') if arr[0] =~ /(\w*)\[(\w*)\]/ hash.merge($1 => {$2 => arr[1]}) else hash.merge(arr[0] => arr[1]) end end end |