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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05bd6cfd3935ea3d449651b5a997497699b5ba47
4
- data.tar.gz: 5e9fcd26cd38218270949a2757a9b1832ea63969
3
+ metadata.gz: 6cbdccba6864dd468cbc605eea82d6b6660e17aa
4
+ data.tar.gz: eb288efc956474d2c738130e1ee3e58140331df7
5
5
  SHA512:
6
- metadata.gz: 4369588f404fd7fa811c6b32af02998b656e13a95058018698ee9b2c67674b8da300c5ff6b736ce0d5f0a0ecbf5aee2f022756c26fce72edfea5fcad34123cd4
7
- data.tar.gz: 9a07124cccbd25d30fbac70a2303b4b239a3871f50a261ba1d50e1a5c58402d04300fc1e930f780ceb1263f0e8097048846ea73ad4866f3c6112103ca84a596e
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
@@ -193,6 +193,8 @@ module Memoist
193
193
  end
194
194
  end
195
195
  end
196
+ # return a chainable method_name symbol if we can
197
+ method_names.length == 1 ? method_names.first : method_names
196
198
  end
197
199
 
198
200
  class AlreadyMemoizedError < RuntimeError; end
@@ -1,3 +1,3 @@
1
1
  module Memoist
2
- VERSION = "0.9.3"
2
+ VERSION = "0.10.0"
3
3
  end
data/memoist.gemspec CHANGED
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.add_development_dependency "bundler", "~> 1.5"
36
36
  spec.add_development_dependency "rake"
37
+ spec.add_development_dependency "minitest", "~> 3.0"
37
38
  end
data/test/memoist_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'memoist'
3
3
 
4
- class MemoistTest < Test::Unit::TestCase
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
- assert_nothing_raised(NameError) do
174
- @person.memoize_all
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
- assert_raise(Memoist::AlreadyMemoizedError) { Person.memoize :name }
292
+ assert_raises(Memoist::AlreadyMemoizedError) { Person.memoize :name }
295
293
  person = Person.new
296
294
  person.extend Memoist
297
- assert_raise(Memoist::AlreadyMemoizedError) { person.memoize :name }
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
- assert_raise(Memoist::AlreadyMemoizedError) { company.memoize :name }
300
+ assert_raises(Memoist::AlreadyMemoizedError) { company.memoize :name }
303
301
  end
304
302
 
305
303
  def test_double_memoization_with_identifier
306
- assert_nothing_raised { Person.memoize :name, :identifier => :again }
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
- assert_raise(NoMethodError) { person.memoize_protected_test }
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
- assert_raise(NoMethodError) { person.is_developer? }
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
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
- require 'test/unit'
1
+ require 'minitest/autorun'
3
2
 
4
3
  $:.unshift File.expand_path(File.dirname(__FILE__)+"/../lib")
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.9.3
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-06-01 00:00:00.000000000 Z
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: