meta_instance 1.0.0 → 1.0.1

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: d4bfd557799d7a5ae48a0dd7ceb48791cc491342
4
- data.tar.gz: ee4f4bd538775a2c3e29682e3842d079ab118bfa
3
+ metadata.gz: 86e57352d477cc93b8cbd9b46ee175a34d5afc55
4
+ data.tar.gz: fcefa4d63aa5f4ecaa51ced21139c6eaf893229f
5
5
  SHA512:
6
- metadata.gz: 194a99f1087ef77810c9f8e860ee8191313d5814a126338ae51e91aea036258380f4ecbc10c1570569a544b921e8e4c89f80f74e6678dd1f9ddbbf024d0ae406
7
- data.tar.gz: 631cc3e95e6155b7a94181b9e05c7aa963feee3874596e9558d910d9251b9153c6ba8e29df6bd29abdc246a48f0b58d797be06cd4a58f91987892221d67d2834
6
+ metadata.gz: 6c368579ee3cc6ca1a05be5011b51df3619364afa300fa0b9f877beec6ecac4952fd23608138993fb3b196d74937384e0620e3f0ae7c69d8a086654883f63e40
7
+ data.tar.gz: 2495c3dc7209c5bfbd1a613f8024d691a726ecd96cb704a120f9b5997a4c6eceeb227cc0c346cafbc6c76a954efd49f5971996455d1d32d54929d2f3082aec34
@@ -1,3 +1,3 @@
1
1
  module MetaInstance
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/meta_instance.rb CHANGED
@@ -35,10 +35,12 @@ module MetaInstance
35
35
 
36
36
  # the original method becomes reaccessible
37
37
  def restore_instance_method(name)
38
- meta_eval {
39
- alias_method name, "#{METHOD_BACKUP_KEY}#{name}"
40
- remove_method "#{METHOD_BACKUP_KEY}#{name}"
41
- }
38
+ if respond_to?("#{METHOD_BACKUP_KEY}#{name}")
39
+ meta_eval {
40
+ alias_method name, "#{METHOD_BACKUP_KEY}#{name}"
41
+ remove_method "#{METHOD_BACKUP_KEY}#{name}"
42
+ }
43
+ end
42
44
  end
43
45
 
44
46
  private
@@ -54,4 +56,4 @@ module MetaInstance
54
56
  metaclass.instance_eval(&block)
55
57
  end
56
58
 
57
- end
59
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "meta_instance/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "meta_instance"
9
+ s.version = MetaInstance::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.license = "MIT"
12
+ s.authors = ["L. Preston Sego III"]
13
+ s.email = "LPSego3+dev@gmail.com"
14
+ s.homepage = "https://github.com/NullVoxPopuli/MetaInstance"
15
+ s.summary = "MetaInstance-#{MetaInstance::VERSION}"
16
+ s.description = "A few helpers for manipulating methods on an instance of an object."
17
+
18
+
19
+ s.files = `git ls-files`.split($/)
20
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
21
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
+ s.require_paths = ["lib"]
23
+
24
+
25
+ s.add_development_dependency "bundler"
26
+ s.add_development_dependency "rspec"
27
+ s.add_development_dependency "pry-byebug"
28
+ s.add_development_dependency "codeclimate-test-reporter"
29
+
30
+ end
@@ -67,6 +67,11 @@ describe MetaInstance do
67
67
  it "doesn't respond_to the backup method" do
68
68
  expect(f).to_not respond_to "#{MetaInstance::METHOD_BACKUP_KEY}bar"
69
69
  end
70
+
71
+ it "doesn't remove a method that isn't there" do
72
+ expect(f).to_not respond_to(:foobar)
73
+ expect(f.restore_instance_method(:foobar)).to be_nil
74
+ end
70
75
  end
71
76
 
72
77
  context "instance_override" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_instance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
@@ -81,6 +81,7 @@ files:
81
81
  - Rakefile
82
82
  - lib/meta_instance.rb
83
83
  - lib/meta_instance/version.rb
84
+ - meta_instance.gemspec
84
85
  - spec/meta_instance_spec.rb
85
86
  - spec/spec_helper.rb
86
87
  - spec/support/foo.rb
@@ -107,7 +108,7 @@ rubyforge_project:
107
108
  rubygems_version: 2.4.1
108
109
  signing_key:
109
110
  specification_version: 4
110
- summary: MetaInstance-1.0.0
111
+ summary: MetaInstance-1.0.1
111
112
  test_files:
112
113
  - spec/meta_instance_spec.rb
113
114
  - spec/spec_helper.rb