map 6.5.0 → 6.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/a.rb +22 -0
  2. data/lib/map.rb +8 -18
  3. data/map.gemspec +2 -1
  4. metadata +3 -2
data/a.rb ADDED
@@ -0,0 +1,22 @@
1
+
2
+ m = Map.new
3
+
4
+ p m
5
+
6
+ m.unshift(:a => :b)
7
+ m.unshift(:c => :d)
8
+ m.unshift(:e => :f)
9
+
10
+ p m
11
+ p(pair = m.shift)
12
+ p m
13
+
14
+ m.push(pair)
15
+ p m
16
+
17
+ p(pair = m.pop)
18
+ p m
19
+
20
+ m.unshift(pair)
21
+ p m
22
+
data/lib/map.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  class Map < Hash
3
- Version = '6.5.0' unless defined?(Version)
3
+ Version = '6.5.1' unless defined?(Version)
4
4
  Load = Kernel.method(:load) unless defined?(Load)
5
5
 
6
6
  class << Map
@@ -250,15 +250,9 @@ class Map < Hash
250
250
  klass.map_for(hash)
251
251
  end
252
252
 
253
- =begin
254
- def self.convert_key(key)
253
+ def Map.convert_key(key)
255
254
  key.kind_of?(Symbol) ? key.to_s : key
256
255
  end
257
- =end
258
-
259
- def self.convert_key(key)
260
- key = key.kind_of?(Symbol) ? key.to_s : key
261
- end
262
256
 
263
257
  def convert_key(key)
264
258
  if klass.respond_to?(:convert_key)
@@ -472,11 +466,9 @@ class Map < Hash
472
466
 
473
467
  def unshift(*args)
474
468
  Map.each_pair(*args) do |key, val|
475
- if key?(key)
476
- delete(key)
477
- else
478
- keys.unshift(key)
479
- end
469
+ key = convert_key(key)
470
+ delete(key)
471
+ keys.unshift(key)
480
472
  __set__(key, val)
481
473
  end
482
474
  self
@@ -484,11 +476,9 @@ class Map < Hash
484
476
 
485
477
  def push(*args)
486
478
  Map.each_pair(*args) do |key, val|
487
- if key?(key)
488
- delete(key)
489
- else
490
- keys.push(key)
491
- end
479
+ key = convert_key(key)
480
+ delete(key)
481
+ keys.push(key)
492
482
  __set__(key, val)
493
483
  end
494
484
  self
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.5.0"
6
+ spec.version = "6.5.1"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "map"
9
9
  spec.description = "description: map kicks the ass"
@@ -12,6 +12,7 @@ Gem::Specification::new do |spec|
12
12
  ["LICENSE",
13
13
  "README",
14
14
  "Rakefile",
15
+ "a.rb",
15
16
  "lib",
16
17
  "lib/map",
17
18
  "lib/map.rb",
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.5.0
4
+ version: 6.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-25 00:00:00.000000000 Z
12
+ date: 2013-05-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'description: map kicks the ass'
15
15
  email: ara.t.howard@gmail.com
@@ -20,6 +20,7 @@ files:
20
20
  - LICENSE
21
21
  - README
22
22
  - Rakefile
23
+ - a.rb
23
24
  - lib/map.rb
24
25
  - lib/map/integrations/active_record.rb
25
26
  - lib/map/options.rb