safe_dup 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fecb2bb437fe993c25f9c37279332468bbb2ebf7
4
- data.tar.gz: 6ca25ab7b90a06b109d50d9e6462a6125805ef16
3
+ metadata.gz: 3a1fa2f5d277d5480f6b45c11dbc355badc3cd56
4
+ data.tar.gz: ca7ff2caadc69bcb635e31292cd1677b9f354be3
5
5
  SHA512:
6
- metadata.gz: 38734e288e3089aa4721d18dc8e1eba0c6f33950e527663936a58b3f1c4c40960e6c6e33bea18af37f3e384457e608c4fa27af78cbf9759b16ad5be537b72867
7
- data.tar.gz: af278ee7942676d7e691f66cf466dcb81e29a44a2bd1b3962e0a224698411d1a3c1967bb0d1ee380e91a94838005911753b3936db39939c4be140506eb2509e1
6
+ metadata.gz: eef8ee0f8eb380f082276c531d2a1b37b2e6847f2db6903d2d46811b2bb66fe31d0c0c0d605561bcfa8fc432d49d674cb744c9546e489925e395ff6264a73dda
7
+ data.tar.gz: a2ded1a54ee443f2c3cd21a804fd2bf5a10654128bc1c2b261533197f9405301293ee16b5158259dd23edd9279e9a094c43c5094370d0d9e67f9656d5ce1567b
data/lib/safe_dup.rb CHANGED
@@ -1,21 +1,48 @@
1
+ # coding: utf-8
1
2
 
2
3
  require_relative "safe_dup/version"
3
4
 
5
+ # Now you too can dup without fear of annoying exceptions!
6
+
4
7
  class Object
5
8
  #By default, reference types use the clone method.
6
- def safe_dup; self.dup; end
9
+ def safe_dup
10
+ dup
11
+ end
7
12
  end
8
13
 
9
14
  #For value types, just return self!
10
15
  module SafeDup
11
- def safe_dup; self; end
16
+ def safe_dup
17
+ self
18
+ end
12
19
  end
13
20
 
14
21
  #Update the Ruby value types.
15
- class Numeric; include SafeDup; end
16
- class NilClass; include SafeDup; end
17
- class TrueClass; include SafeDup; end
18
- class FalseClass; include SafeDup; end
19
- class Symbol; include SafeDup; end
20
- class Regexp; include SafeDup; end
22
+ class Numeric
23
+ include SafeDup
24
+ end
25
+
26
+ class NilClass
27
+ include SafeDup
28
+ end
21
29
 
30
+ class TrueClass
31
+ include SafeDup
32
+ end
33
+
34
+ class FalseClass
35
+ include SafeDup
36
+ end
37
+
38
+ class Symbol
39
+ include SafeDup
40
+ end
41
+
42
+ class Regexp
43
+ include SafeDup
44
+ end
45
+
46
+ class Thread
47
+ include SafeDup
48
+ end
@@ -1,3 +1,3 @@
1
1
  module SafeDup
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -24,7 +24,7 @@ class SafeDupTester < Minitest::Test
24
24
  assert_equal((false).safe_dup, false)
25
25
  assert_equal((false).safe_dup.object_id, (false).object_id)
26
26
 
27
- assert_equal((nil).safe_dup, nil)
27
+ assert_nil((nil).safe_dup)
28
28
  assert_equal((nil).safe_dup.object_id, (nil).object_id)
29
29
 
30
30
  rex = /ABC/
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe_dup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-13 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -105,10 +105,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.2.3
108
+ rubygems_version: 2.5.2
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: A safer version of the dup method.
112
112
  test_files:
113
113
  - test/safe_dup_tests.rb
114
- has_rdoc: