map 6.4.1 → 6.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/map.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  class Map < Hash
3
- Version = '6.4.1' unless defined?(Version)
3
+ Version = '6.4.2' unless defined?(Version)
4
4
  Load = Kernel.method(:load) unless defined?(Load)
5
5
 
6
6
  class << Map
data/lib/map/params.rb CHANGED
@@ -30,6 +30,16 @@ class Map
30
30
  param_for(*args, &block)
31
31
  end
32
32
 
33
+ def to_params
34
+ to_params = Array.new
35
+
36
+ depth_first_each do |key, val|
37
+ to_params.push(param_for(key))
38
+ end
39
+
40
+ to_params.join('&')
41
+ end
42
+
33
43
  module Param
34
44
  def param_for(value, prefix = nil)
35
45
  case value
data/map.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "map"
6
- spec.version = "6.4.1"
6
+ spec.version = "6.4.2"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "map"
9
9
  spec.description = "description: map kicks the ass"
data/test/map_test.rb CHANGED
@@ -748,6 +748,9 @@ Testing Map do
748
748
  assert{ m.name_for(:A, :B, :C) == 'map[A][B][C]' }
749
749
 
750
750
  assert{ m.name_for(:A, :B, :C, :prefix => :foo) == 'foo[A][B][C]' }
751
+
752
+ m = Map.for({"a"=>{"b"=>42}, "x"=>{"y"=>42}, "foo"=>:bar, "array"=>[{"k"=>:v}]})
753
+ assert{ m.to_params == "map[a][b]=42&map[x][y]=42&map[foo]=bar&map[array][][k]=v" }
751
754
  end
752
755
 
753
756
  testing 'delete_if' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: map
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.1
4
+ version: 6.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: