safe_clone 0.0.9 → 1.0.0

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: 642d0f06a657cc21e7bdaa95cdaeac8d9007b8eb
4
- data.tar.gz: a2f40846d9627868b047795003e3cb0959dbe014
3
+ metadata.gz: '08afbd5a88faa6f508dc4dd8744b217a03f5df0b'
4
+ data.tar.gz: 0df3cbc0dc1b5b181f38091e8f75df302a1def24
5
5
  SHA512:
6
- metadata.gz: 644dca861d95fd253a0648800f54634d4a2371e000515e77184490c63fccb1f4c974863417ff21cf6acb2723d35f7eae63cb98ab06ead5de760f2261405ecbfe
7
- data.tar.gz: 283e2650a327fe2fbfb217ea6f15cbd1f1d535b7ae95b55398c93f1027a67d1665764998827fb200cbc0d25010878d74f8a593553155939d39e4f08b8cbc35a6
6
+ metadata.gz: 8925ea3f33cbe71ac5ad0e27f764623c4b223aaaaf0ec9d07aa3a2058babd2244e0222d7a73e6edcb90be61c494b9a81f870464506b3eff59f1b8e7b7f989fef
7
+ data.tar.gz: cfad571404643eab59beef2899ad13556574ccf737ed7e2b5a9037803e69d4f4219d5fca9fffc4dd3526514639c5b8457f26193e14ecff282b564d5e2f32d4da
@@ -1,5 +1,8 @@
1
+ # coding: utf-8
2
+
1
3
  require_relative "safe_clone/version"
2
4
 
5
+ # The default safe clone is Ruby clone.
3
6
  class Object
4
7
  #By default, reference types use the clone method.
5
8
  def safe_clone
@@ -7,39 +10,44 @@ class Object
7
10
  end
8
11
  end
9
12
 
10
- #For value types, just return self!
13
+ # For value types, safe clone just returns self.
11
14
  module SafeClone
12
15
  def safe_clone
13
16
  self
14
17
  end
15
18
  end
16
19
 
17
- #Update the Ruby value types.
20
+ # Numeric does safe clone.
18
21
  class Numeric
19
22
  include SafeClone
20
23
  end
21
24
 
25
+ # NilClass does safe clone.
22
26
  class NilClass
23
27
  include SafeClone
24
28
  end
25
29
 
30
+ # TrueClass does safe clone.
26
31
  class TrueClass
27
32
  include SafeClone
28
33
  end
29
34
 
35
+ # FalseClass does safe clone.
30
36
  class FalseClass
31
37
  include SafeClone
32
38
  end
33
39
 
40
+ # Symbols do safe clone.
34
41
  class Symbol
35
42
  include SafeClone
36
43
  end
37
44
 
45
+ # Regular expressions do safe clone.
38
46
  class Regexp
39
47
  include SafeClone
40
48
  end
41
49
 
50
+ # Threads do safe clone.
42
51
  class Thread
43
52
  include SafeClone
44
53
  end
45
-
@@ -1,3 +1,3 @@
1
1
  module SafeClone
2
- VERSION = "0.0.9"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -8,6 +8,11 @@ Rake::TestTask.new do |t|
8
8
  t.verbose = false
9
9
  end
10
10
 
11
+ desc "Run a scan for smelly code!"
12
+ task :reek do |t|
13
+ `reek --no-color lib > reek.txt`
14
+ end
15
+
11
16
  desc "Fire up an IRB session with safe_clone preloaded."
12
17
  task :console do
13
18
  system "ruby irbt.rb local"
@@ -0,0 +1 @@
1
+ 0 total warnings
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency 'minitest', "~> 5.7"
23
23
  spec.add_development_dependency 'minitest_visible', "~> 0.1"
24
-
24
+ spec.add_development_dependency 'reek', "~> 5.0.2"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe_clone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-08 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: reek
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 5.0.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 5.0.2
69
83
  description: A safer version of the clone method that avoids unnecessary exceptions.
70
84
  email:
71
85
  - peter.c.camilleri@gmail.com
@@ -83,6 +97,7 @@ files:
83
97
  - lib/safe_clone.rb
84
98
  - lib/safe_clone/version.rb
85
99
  - rakefile.rb
100
+ - reek.txt
86
101
  - safe_clone.gemspec
87
102
  - test/safe_clone_tests.rb
88
103
  homepage: https://github.com/PeterCamilleri/safe_clone