memoist 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6eafbb59c1568063bab08d879276b6f9dd8a08f4
4
- data.tar.gz: 6dc2a93ab06eb367aa4431534b7ed4d768824366
2
+ SHA256:
3
+ metadata.gz: af4a5344777f88d07223d20fae69de50867916ed579032325013f4c5160b37c7
4
+ data.tar.gz: 5997e635a721a2bfcf779592e61ea1bda7361208c9182cdbd8f6a288bf32e78c
5
5
  SHA512:
6
- metadata.gz: 0d450d07e8d37029a54b5383095acfb7d0e2a772cff9deee85d0f050930e566124443a9a6b7e8c42c508ad21eb14c8046963eb220fbf8d60f6ff5ad523349fd1
7
- data.tar.gz: d7090d4fec3b79ef89b3ced3ca136a866d1f4528b7819c7902a292d11d205d5c2018154dc2c5586a6c38d6674755527075d32515420293ad68b59d486e332118
6
+ metadata.gz: ff876e4b317f71b26b6c3505977fb707d839e97820852fc97d117cc58d0f00c3d1f2a952a000062ef63af2c1289ad6852c02a68e11f8342d73c95dc42976fe6c
7
+ data.tar.gz: 15f0e432b722826bff600c642be765dcc4f6e2a7ae8b32b2f907a945cbbcbf97b87f9589262141430646d8880570223ef592e0f2cde92b21cc0dbb8263a3b3b0
@@ -2,18 +2,17 @@ sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
4
  rvm:
5
- - 1.8.7
6
- - 1.9.2
7
5
  - 1.9.3
8
6
  - 2.0.0
9
7
  - 2.1.10
10
8
  - 2.2.7
11
9
  - 2.3.4
12
10
  - 2.4.1
11
+ - 2.5.1
12
+ - 2.6.0
13
13
  - ruby-head
14
- - jruby-18mode
15
14
  - jruby-19mode
16
- - jruby-9.1.5.0
15
+ - jruby-9.1.9.0
17
16
  - jruby-head
18
17
 
19
18
  before_install:
@@ -0,0 +1,122 @@
1
+ # Changelog
2
+
3
+ ## [v0.16.1](https://github.com/matthewrudy/memoist/tree/v0.16.1) (2019-11-08)
4
+
5
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.16.0...v0.16.1)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Remove ruby 1.9.2 from travis build matrix [\#84](https://github.com/matthewrudy/memoist/pull/84) ([unasuke](https://github.com/unasuke))
10
+ - Make Memoist.escape\_punctuation compatible with MRI 2.7 [\#82](https://github.com/matthewrudy/memoist/pull/82) ([casperisfine](https://github.com/casperisfine))
11
+ - add 2.5.1 to travis [\#77](https://github.com/matthewrudy/memoist/pull/77) ([matthewrudy](https://github.com/matthewrudy))
12
+ - Remove ghit.me [\#74](https://github.com/matthewrudy/memoist/pull/74) ([matthewrudy](https://github.com/matthewrudy))
13
+ - Place sample code for execution in README.md [\#73](https://github.com/matthewrudy/memoist/pull/73) ([3nan3](https://github.com/3nan3))
14
+ - Require Ruby \>=1.9.2 [\#69](https://github.com/matthewrudy/memoist/pull/69) ([matthewrudy](https://github.com/matthewrudy))
15
+
16
+ ## [v0.16.0](https://github.com/matthewrudy/memoist/tree/v0.16.0) (2017-06-20)
17
+
18
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.15.0...v0.16.0)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Fix undefined `memoized\_methods` error raised when a parent class has not call `memoize` [\#68](https://github.com/matthewrudy/memoist/pull/68) ([PikachuEXE](https://github.com/PikachuEXE))
23
+ - Add support for class-level cache flushing. [\#67](https://github.com/matthewrudy/memoist/pull/67) ([JoeMcB](https://github.com/JoeMcB))
24
+ - Add ruby 2.4 to travis \(bump 2.2 and 2.3 versions\) [\#64](https://github.com/matthewrudy/memoist/pull/64) ([jrafanie](https://github.com/jrafanie))
25
+ - Fix tests for Ruby \< 1.9.3 [\#56](https://github.com/matthewrudy/memoist/pull/56) ([matthewrudy](https://github.com/matthewrudy))
26
+ - Add return in comments for `flush\_cache`. [\#55](https://github.com/matthewrudy/memoist/pull/55) ([joshuapinter](https://github.com/joshuapinter))
27
+ - Update readme [\#53](https://github.com/matthewrudy/memoist/pull/53) ([biow0lf](https://github.com/biow0lf))
28
+
29
+ ## [v0.15.0](https://github.com/matthewrudy/memoist/tree/v0.15.0) (2016-08-23)
30
+
31
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.14.0...v0.15.0)
32
+
33
+ **Merged pull requests:**
34
+
35
+ - Remove test warnings [\#52](https://github.com/matthewrudy/memoist/pull/52) ([matthewrudy](https://github.com/matthewrudy))
36
+ - Use SVG badge over PNG [\#44](https://github.com/matthewrudy/memoist/pull/44) ([olivierlacan](https://github.com/olivierlacan))
37
+
38
+ ## [v0.14.0](https://github.com/matthewrudy/memoist/tree/v0.14.0) (2015-12-15)
39
+
40
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.13.0...v0.14.0)
41
+
42
+ **Merged pull requests:**
43
+
44
+ - Faster2: Cache the method, ivar, and arity and the ancestry memoized methods [\#38](https://github.com/matthewrudy/memoist/pull/38) ([jrafanie](https://github.com/jrafanie))
45
+
46
+ ## [v0.13.0](https://github.com/matthewrudy/memoist/tree/v0.13.0) (2015-11-26)
47
+
48
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.12.0...v0.13.0)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Faster memoist with less object allocations [\#36](https://github.com/matthewrudy/memoist/pull/36) ([jrafanie](https://github.com/jrafanie))
53
+ - Be optimistic about bundler version [\#35](https://github.com/matthewrudy/memoist/pull/35) ([lotyrin](https://github.com/lotyrin))
54
+ - Add syntax highlighting for code blocks. [\#34](https://github.com/matthewrudy/memoist/pull/34) ([joshuapinter](https://github.com/joshuapinter))
55
+
56
+ ## [v0.12.0](https://github.com/matthewrudy/memoist/tree/v0.12.0) (2015-04-13)
57
+
58
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.11.0...v0.12.0)
59
+
60
+ **Merged pull requests:**
61
+
62
+ - Fix forking link [\#30](https://github.com/matthewrudy/memoist/pull/30) ([brandondrew](https://github.com/brandondrew))
63
+ - Update README with :identifier info [\#29](https://github.com/matthewrudy/memoist/pull/29) ([fervic](https://github.com/fervic))
64
+
65
+ ## [v0.11.0](https://github.com/matthewrudy/memoist/tree/v0.11.0) (2014-10-10)
66
+
67
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.10.0...v0.11.0)
68
+
69
+ **Merged pull requests:**
70
+
71
+ - Call abs on arity when extracting reload [\#27](https://github.com/matthewrudy/memoist/pull/27) ([bradylove](https://github.com/bradylove))
72
+
73
+ ## [v0.10.0](https://github.com/matthewrudy/memoist/tree/v0.10.0) (2014-08-13)
74
+
75
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.9.3...v0.10.0)
76
+
77
+ **Merged pull requests:**
78
+
79
+ - Make memoize return a :symbol [\#24](https://github.com/matthewrudy/memoist/pull/24) ([matthewrudy](https://github.com/matthewrudy))
80
+ - Use Minitest [\#19](https://github.com/matthewrudy/memoist/pull/19) ([matthewrudy](https://github.com/matthewrudy))
81
+
82
+ ## [v0.9.3](https://github.com/matthewrudy/memoist/tree/v0.9.3) (2014-06-01)
83
+
84
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/v0.9.2...v0.9.3)
85
+
86
+ **Merged pull requests:**
87
+
88
+ - Remove Array caching hack [\#17](https://github.com/matthewrudy/memoist/pull/17) ([matthewrudy](https://github.com/matthewrudy))
89
+
90
+ ## [v0.9.2](https://github.com/matthewrudy/memoist/tree/v0.9.2) (2014-04-16)
91
+
92
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/0.9.0...v0.9.2)
93
+
94
+ **Merged pull requests:**
95
+
96
+ - Give double-memoize errors their own error class [\#15](https://github.com/matthewrudy/memoist/pull/15) ([zachhale](https://github.com/zachhale))
97
+ - Add tax-themed example for class method memoization fixes \#9 [\#10](https://github.com/matthewrudy/memoist/pull/10) ([fny](https://github.com/fny))
98
+
99
+ ## [0.9.0](https://github.com/matthewrudy/memoist/tree/0.9.0) (2013-03-20)
100
+
101
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/0.2.0...0.9.0)
102
+
103
+ **Merged pull requests:**
104
+
105
+ - Update README.md to include memoization bypass description [\#6](https://github.com/matthewrudy/memoist/pull/6) ([andreychernih](https://github.com/andreychernih))
106
+ - Adds a note about the MIT License [\#4](https://github.com/matthewrudy/memoist/pull/4) ([matiaskorhonen](https://github.com/matiaskorhonen))
107
+
108
+ ## [0.2.0](https://github.com/matthewrudy/memoist/tree/0.2.0) (2012-08-15)
109
+
110
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/0.1.0...0.2.0)
111
+
112
+ **Merged pull requests:**
113
+
114
+ - Improved performance of flush\_cache and prime\_cache when parameters are passed to them. [\#2](https://github.com/matthewrudy/memoist/pull/2) ([jrafanie](https://github.com/jrafanie))
115
+
116
+ ## [0.1.0](https://github.com/matthewrudy/memoist/tree/0.1.0) (2012-01-24)
117
+
118
+ [Full Changelog](https://github.com/matthewrudy/memoist/compare/7a5352d6b6c4219f37f329d2422985961c749748...0.1.0)
119
+
120
+
121
+
122
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -3,8 +3,6 @@ Memoist
3
3
 
4
4
  [![Build Status](https://travis-ci.org/matthewrudy/memoist.svg?branch=master)](https://travis-ci.org/matthewrudy/memoist)
5
5
 
6
- [![ghit.me](https://ghit.me/badge.svg?repo=matthewrudy/memoist)](https://ghit.me/repo/matthewrudy/memoist)
7
-
8
6
  Memoist is an extraction of ActiveSupport::Memoizable.
9
7
 
10
8
  Since June 2011 ActiveSupport::Memoizable has been deprecated.
@@ -22,10 +20,20 @@ class Person
22
20
  extend Memoist
23
21
 
24
22
  def social_security
23
+ puts "execute!"
25
24
  decrypt_social_security
26
25
  end
27
26
  memoize :social_security
28
27
  end
28
+
29
+ person = Person.new
30
+
31
+ person.social_security
32
+ # execute!
33
+ # => (returns decrypt_social_security)
34
+
35
+ person.social_security
36
+ # => (returns the memoized value)
29
37
  ```
30
38
 
31
39
  And person.social_security will only be calculated once.
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'memoist/version'
4
- require 'memoist/core_ext/singleton_class'
5
4
 
6
5
  module Memoist
7
6
  def self.extended(extender)
@@ -39,10 +38,12 @@ module Memoist
39
38
  end
40
39
 
41
40
  def self.escape_punctuation(string)
42
- string = string.is_a?(String) ? string.dup : string.to_s
41
+ string = string.to_s
43
42
 
44
43
  return string unless string.end_with?('?'.freeze, '!'.freeze)
45
44
 
45
+ string = string.dup if string.frozen?
46
+
46
47
  # A String can't end in both ? and !
47
48
  if string.sub!(/\?\Z/, '_query'.freeze)
48
49
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Memoist
4
- VERSION = '0.16.0'.freeze
4
+ VERSION = '0.16.1'.freeze
5
5
  end
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
33
33
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
34
34
  spec.require_paths = ['lib']
35
35
 
36
+ spec.required_ruby_version = '>= 1.9.2'
37
+
36
38
  spec.add_development_dependency 'benchmark-ips'
37
39
  spec.add_development_dependency 'bundler'
38
40
  if RUBY_VERSION < '1.9.3'
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.16.0
4
+ version: 0.16.1
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: 2017-06-20 00:00:00.000000000 Z
22
+ date: 2019-11-08 00:00:00.000000000 Z
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: benchmark-ips
@@ -97,12 +97,12 @@ extra_rdoc_files: []
97
97
  files:
98
98
  - ".gitignore"
99
99
  - ".travis.yml"
100
+ - CHANGELOG.md
100
101
  - Gemfile
101
102
  - LICENSE.md
102
103
  - README.md
103
104
  - Rakefile
104
105
  - lib/memoist.rb
105
- - lib/memoist/core_ext/singleton_class.rb
106
106
  - lib/memoist/version.rb
107
107
  - memoist.gemspec
108
108
  - script/benchmark.rb
@@ -120,15 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: '0'
123
+ version: 1.9.2
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubyforge_project:
131
- rubygems_version: 2.6.10
130
+ rubygems_version: 3.0.4
132
131
  signing_key:
133
132
  specification_version: 4
134
133
  summary: memoize methods invocation
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kernel
4
- # Returns the object's singleton class.
5
- unless respond_to?(:singleton_class)
6
- def singleton_class
7
- class << self
8
- self
9
- end
10
- end
11
- end # exists in 1.9.2
12
- end