mutant 0.5.8 → 0.5.9

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: b3f5f4cd0f498cb559067c145ca64b0c497499c8
4
- data.tar.gz: b9f6684021373e4dec17112f1ec6bb91828e81ca
3
+ metadata.gz: cf574dc48496c63daaefac87f3603ba5b2c4703a
4
+ data.tar.gz: 2666871190b2b4788d9e216f3e3fe155833b6e00
5
5
  SHA512:
6
- metadata.gz: 2d4f078d7a79185bc8fce654479b54b9410b3ae9342cc4ab8c77e78792851d362dbfae4f5951a1a800cc64ce291f2eebe22e6164f9c268fb5ecaa55b7a7fea22
7
- data.tar.gz: 8b52fca4d1af67bc6d832d90d8745092ae23c68a4a6737c31a37912f7774f2e093d9083c7ab5f9f07ab7c324010c70d43e5b0a4bc95a1ecd167243c4fb7b84ec
6
+ metadata.gz: b837342c26c28e970e5ff9784531fce12fd26fb30dde6ee7ef0f856910a44026891534468a488459b81e7e653167948c913ef13e0f5e6b01f16c7c45ab23413a
7
+ data.tar.gz: ff9190edab3e81f861e06767196b268327e690b22b1229b94296af49c596b3e057fc45ffc11471a9fe18730e42ee6dec176b03fab465bee3917c189bdb8fc84d
data/Changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.5.9 2014-03-28
2
+
3
+ Changes:
4
+
5
+ * Fix mutation of memoized methods with the memoizable gem.
6
+
1
7
  # v0.5.8 2014-03-26
2
8
 
3
9
  Changes:
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 18
3
- total_score: 794
3
+ total_score: 802
@@ -7,7 +7,7 @@ module Mutant
7
7
  class Instance < self
8
8
  SUBJECT_CLASS = Subject::Method::Instance
9
9
 
10
- # Dispatching builder, detects adamantium case
10
+ # Dispatching builder, detects memoizable case
11
11
  #
12
12
  # @param [Cache] cache
13
13
  # @param [Class, Module] scope
@@ -19,7 +19,7 @@ module Mutant
19
19
  #
20
20
  def self.build(cache, scope, method)
21
21
  name = method.name
22
- if scope.ancestors.include?(::Adamantium) and scope.memoized?(name)
22
+ if scope.ancestors.include?(::Memoizable) and scope.memoized?(name)
23
23
  return Memoized.new(cache, scope, method)
24
24
  end
25
25
  super
@@ -52,6 +52,18 @@ module Mutant
52
52
  end
53
53
  memoize :source
54
54
 
55
+ # Prepare subject for mutation insertion
56
+ #
57
+ # @return [self]
58
+ #
59
+ # @api private
60
+ #
61
+ def prepare
62
+ scope.send(:memoized_methods).instance_variable_get(:@memory).delete(name)
63
+ scope.send(:undef_method, name)
64
+ self
65
+ end
66
+
55
67
  private
56
68
 
57
69
  # Return mutations
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # The current mutant version
5
- VERSION = '0.5.8'.freeze
5
+ VERSION = '0.5.9'.freeze
6
6
  end # Mutant
data/mutant.gemspec CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |gem|
31
31
  gem.add_runtime_dependency('ice_nine', '~> 0.11.0')
32
32
  gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
33
33
  gem.add_runtime_dependency('adamantium', '~> 0.2.0')
34
+ gem.add_runtime_dependency('memoizable', '~> 0.4.2')
34
35
  gem.add_runtime_dependency('equalizer', '~> 0.0.7')
35
36
  gem.add_runtime_dependency('inflecto', '~> 0.0.2')
36
37
  gem.add_runtime_dependency('anima', '~> 0.2.0')
@@ -51,6 +51,34 @@ describe Mutant::Subject::Method::Instance::Memoized do
51
51
  s(:def, :foo, s(:args))
52
52
  end
53
53
 
54
+ describe '#prepare' do
55
+
56
+ let(:context) do
57
+ Mutant::Context::Scope.new(scope, double('Source Path'))
58
+ end
59
+
60
+ let(:scope) do
61
+ Class.new do
62
+ include Memoizable
63
+ def foo
64
+ end
65
+ memoize :foo
66
+ end
67
+ end
68
+
69
+ subject { object.prepare }
70
+
71
+ it 'undefines memoizer' do
72
+ expect { subject }.to change { scope.memoized?(:foo) }.from(true).to(false)
73
+ end
74
+
75
+ it 'undefines method on scope' do
76
+ expect { subject }.to change { scope.instance_methods.include?(:foo) }.from(true).to(false)
77
+ end
78
+
79
+ it_should_behave_like 'a command method'
80
+ end
81
+
54
82
  describe '#source' do
55
83
  subject { object.source }
56
84
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-26 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: memoizable
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 0.4.2
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 0.4.2
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: equalizer
127
141
  requirement: !ruby/object:Gem::Requirement