map 1.2.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/map.rb +10 -13
- data/test/map_test.rb +0 -3
- metadata +5 -6
- data/a.rb +0 -15
data/lib/map.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Map < Hash
|
2
|
-
Version = '1.
|
2
|
+
Version = '1.3.0' unless defined?(Version)
|
3
3
|
Load = Kernel.method(:load) unless defined?(Load)
|
4
4
|
|
5
5
|
class << Map
|
@@ -381,18 +381,6 @@ class Map < Hash
|
|
381
381
|
hash
|
382
382
|
end
|
383
383
|
|
384
|
-
def to_yaml(*args, &block)
|
385
|
-
as_hash{ super }
|
386
|
-
end
|
387
|
-
|
388
|
-
def to_json(*args, &block)
|
389
|
-
as_hash{ super }
|
390
|
-
end
|
391
|
-
|
392
|
-
def as_json(*args, &block)
|
393
|
-
as_hash{ super }
|
394
|
-
end
|
395
|
-
|
396
384
|
def as_hash
|
397
385
|
@class = Hash
|
398
386
|
yield
|
@@ -404,6 +392,10 @@ class Map < Hash
|
|
404
392
|
@class || super
|
405
393
|
end
|
406
394
|
|
395
|
+
def to_yaml(*args, &block)
|
396
|
+
as_hash{ super }
|
397
|
+
end
|
398
|
+
|
407
399
|
def to_array
|
408
400
|
array = []
|
409
401
|
each{|*pair| array.push(pair)}
|
@@ -416,8 +408,13 @@ class Map < Hash
|
|
416
408
|
end
|
417
409
|
|
418
410
|
def stringify_keys!; self end
|
411
|
+
def stringify_keys; dup end
|
419
412
|
def symbolize_keys!; self end
|
413
|
+
def symbolize_keys; dup end
|
420
414
|
def to_options!; self end
|
415
|
+
def to_options; dup end
|
416
|
+
def with_indifferent_access!; self end
|
417
|
+
def with_indifferent_access; dup end
|
421
418
|
end
|
422
419
|
|
423
420
|
module Kernel
|
data/test/map_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ara T. Howard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-11 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -28,7 +28,6 @@ extensions: []
|
|
28
28
|
extra_rdoc_files: []
|
29
29
|
|
30
30
|
files:
|
31
|
-
- a.rb
|
32
31
|
- lib/map.rb
|
33
32
|
- Rakefile
|
34
33
|
- README
|
data/a.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
$:.push('./lib')
|
2
|
-
require 'map'
|
3
|
-
require 'rubygems'
|
4
|
-
require 'json'
|
5
|
-
require 'active_support'
|
6
|
-
require 'tagz'
|
7
|
-
|
8
|
-
|
9
|
-
map = Map.new
|
10
|
-
42.times{|i| map[i] = Map[:a,0, :b,1, :c,2] }
|
11
|
-
json = JSON.pretty_generate(map)
|
12
|
-
|
13
|
-
|
14
|
-
json = JSON.pretty_generate(map)
|
15
|
-
puts json
|