memoist 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -4
- data/lib/memoist.rb +2 -0
- data/lib/memoist/version.rb +1 -1
- data/memoist.gemspec +1 -0
- data/test/memoist_test.rb +18 -11
- data/test/test_helper.rb +1 -2
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cbdccba6864dd468cbc605eea82d6b6660e17aa
|
4
|
+
data.tar.gz: eb288efc956474d2c738130e1ee3e58140331df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de14221820dc0c53f805e441a6a6b3e85fac5ae3da819d9e3accab2a485ab8399af8e2b852ea121d533831e0204b43774660c665a3bd054c13a40c9d6d028d5
|
7
|
+
data.tar.gz: da1e5080bd827b606c79e395f4f089a8b2df4d8ca7a069b8032f7532bf35c1a3349f8659b98e1ed4a9ae45ea50152bbf1d9d79f40b9361492e1be0d92b13cba5
|
data/.travis.yml
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.1.0
|
4
|
-
- 2.0.0
|
5
|
-
- 1.9.3
|
6
3
|
- 1.8.7
|
4
|
+
- 1.9.2
|
5
|
+
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1.0
|
7
8
|
- jruby-18mode
|
8
9
|
- jruby-19mode
|
9
10
|
- rbx-2
|
10
|
-
|
11
|
+
- ruby-head
|
12
|
+
- jruby-head
|
13
|
+
- ree
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- rvm: ruby-head
|
17
|
+
- rvm: jruby-head
|
data/lib/memoist.rb
CHANGED
data/lib/memoist/version.rb
CHANGED
data/memoist.gemspec
CHANGED
data/test/memoist_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'memoist'
|
3
3
|
|
4
|
-
class MemoistTest <
|
4
|
+
class MemoistTest < Minitest::Unit::TestCase
|
5
5
|
|
6
6
|
class CallCounter
|
7
7
|
|
@@ -170,10 +170,8 @@ class MemoistTest < Test::Unit::TestCase
|
|
170
170
|
def test_memoization_with_punctuation
|
171
171
|
assert_equal true, @person.name?
|
172
172
|
|
173
|
-
|
174
|
-
|
175
|
-
@person.unmemoize_all
|
176
|
-
end
|
173
|
+
@person.memoize_all
|
174
|
+
@person.unmemoize_all
|
177
175
|
end
|
178
176
|
|
179
177
|
def test_memoization_flush_with_punctuation
|
@@ -291,19 +289,19 @@ class MemoistTest < Test::Unit::TestCase
|
|
291
289
|
end
|
292
290
|
|
293
291
|
def test_double_memoization
|
294
|
-
|
292
|
+
assert_raises(Memoist::AlreadyMemoizedError) { Person.memoize :name }
|
295
293
|
person = Person.new
|
296
294
|
person.extend Memoist
|
297
|
-
|
295
|
+
assert_raises(Memoist::AlreadyMemoizedError) { person.memoize :name }
|
298
296
|
|
299
297
|
company = Company.new
|
300
298
|
company.extend Memoist
|
301
299
|
company.memoize :name
|
302
|
-
|
300
|
+
assert_raises(Memoist::AlreadyMemoizedError) { company.memoize :name }
|
303
301
|
end
|
304
302
|
|
305
303
|
def test_double_memoization_with_identifier
|
306
|
-
|
304
|
+
Person.memoize :name, :identifier => :again
|
307
305
|
end
|
308
306
|
|
309
307
|
def test_memoization_with_a_subclass
|
@@ -314,17 +312,26 @@ class MemoistTest < Test::Unit::TestCase
|
|
314
312
|
assert_equal 1, student.name_calls
|
315
313
|
end
|
316
314
|
|
315
|
+
def test_memoization_is_chainable
|
316
|
+
klass = Class.new do
|
317
|
+
def foo; "bar"; end
|
318
|
+
end
|
319
|
+
klass.extend Memoist
|
320
|
+
chainable = klass.memoize :foo
|
321
|
+
assert_equal :foo, chainable
|
322
|
+
end
|
323
|
+
|
317
324
|
def test_protected_method_memoization
|
318
325
|
person = Person.new
|
319
326
|
|
320
|
-
|
327
|
+
assert_raises(NoMethodError) { person.memoize_protected_test }
|
321
328
|
assert_equal "protected", person.send(:memoize_protected_test)
|
322
329
|
end
|
323
330
|
|
324
331
|
def test_private_method_memoization
|
325
332
|
person = Person.new
|
326
333
|
|
327
|
-
|
334
|
+
assert_raises(NoMethodError) { person.is_developer? }
|
328
335
|
assert_equal "Yes", person.send(:is_developer?)
|
329
336
|
assert_equal 1, person.is_developer_calls
|
330
337
|
assert_equal "Yes", person.send(:is_developer?)
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memoist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Peek
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
|
-
date: 2014-
|
22
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: bundler
|
@@ -49,6 +49,20 @@ dependencies:
|
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: minitest
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - "~>"
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '3.0'
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - "~>"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.0'
|
52
66
|
description:
|
53
67
|
email:
|
54
68
|
- josh@joshpeek.com
|
@@ -106,4 +120,3 @@ summary: memoize methods invocation
|
|
106
120
|
test_files:
|
107
121
|
- test/memoist_test.rb
|
108
122
|
- test/test_helper.rb
|
109
|
-
has_rdoc:
|