pakiderm 2.0.0 → 2.0.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: 5a06111ba9f942e52a25123a6bd971bd9d589aee
4
- data.tar.gz: 1c44ca4ae3fde3db92211845f9c9d17102929ce5
2
+ SHA256:
3
+ metadata.gz: '08f9f75542494482d1a1a556c39f4b96c3711807aef701e90e51f9ff709515ac'
4
+ data.tar.gz: a6d903bd7a22835612c141f2cad52fbe9f28ca552ce829c46730977aae3f2f88
5
5
  SHA512:
6
- metadata.gz: f982969d4f44cdd49b75b7f51bcbd927578ffc25c085f776b464684acedf85332222db71c403d193594a92b60fb21f2f8d61c1220175f1ee93cf761e5268f9dc
7
- data.tar.gz: 59ba25e547895beaa4d345b3ff7a1b9c14551e5671be21c67948590fafddd534dcbe14efaf3ff7354e6bad9d5f2f46869b52a475bcfe7fde26b434c08d0d4454
6
+ metadata.gz: 301114c77d1a62bba6f9ec3405551dc5d1a89c99290baee180e2ecb0eee33f8bd8b33946e19c0c93a63b074a7e9eb253670a7cb86668eb3553d29742741d6ac9
7
+ data.tar.gz: 5e465d6aaec3106149eae792501583fe2c24660fa2ac5073e105659e0301cdacf38963624457a48e5a0cc89574ff76db9aaa1b4192275cae598d8db7f09af3a2
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ ## Pakiderm 2.0.1 (2021-02-24) ##
2
+
3
+ * Remove `ruby_version` restriction from gemspec to allow usage in Ruby 3.0.
4
+
5
+ ## Pakiderm 2.0.0 (2017-04-02) ##
6
+
7
+ * Use a lighter memoization stragegy based on `instance_variable_defined?`.
8
+ * Remove support for `assignable`; not that useful in practice.
data/README.md CHANGED
@@ -1,35 +1,32 @@
1
- Pakiderm
1
+ Pakiderm [![Gem Version](https://badge.fury.io/rb/pakiderm.svg)](http://badge.fury.io/rb/pakiderm) [![Build Status](https://github.com/ElMassimo/pakiderm/workflows/build/badge.svg)](https://github.com/ElMassimo/pakiderm/actions) [![Test Coverage](https://codeclimate.com/github/ElMassimo/pakiderm/badges/coverage.svg)](https://codeclimate.com/github/ElMassimo/pakiderm) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ElMassimo/queryable/blob/master/LICENSE.txt)
2
2
  =====================
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/pakiderm.svg)](http://badge.fury.io/rb/pakiderm)
5
- [![Build Status](https://travis-ci.org/ElMassimo/pakiderm.svg)](https://travis-ci.org/ElMassimo/pakiderm)
6
- [![Coverage Status](https://coveralls.io/repos/github/ElMassimo/pakiderm/badge.svg?branch=master)](https://coveralls.io/github/ElMassimo/pakiderm?branch=master)
7
- [![Inline docs](http://inch-ci.org/github/ElMassimo/pakiderm.svg)](http://inch-ci.org/github/ElMassimo/pakiderm)
8
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ElMassimo/queryable/blob/master/LICENSE.txt)
4
+ Allows you to unobtrusively memoize methods without parameters.
9
5
 
10
- Allows you to unobtrusively memoize simple methods.
11
-
12
- ## Usage
13
6
  ```ruby
14
- class Counter
7
+ class Stopwatch
15
8
  extend Pakiderm
16
9
 
10
+ def start
11
+ @started_at = Time.now
12
+ end
13
+
14
+ def stop
15
+ elapsed_time
16
+ end
17
+
17
18
  memoize \
18
- def increment
19
- @sum = 1 + @sum.to_i
19
+ def elapsed_time
20
+ Time.now - @started_at
20
21
  end
21
22
  end
22
23
  ```
23
- Your method will only be called the first time, the result will be stored and returned on subsequent invocations.
24
- ```irb
25
- counter = Counter.new
26
- => Counter
27
-
28
- counter.increment
29
- => 1
30
-
31
- counter.increment
32
- => 1
24
+ Memoized methods will only be called the first time; the result will be stored and returned on subsequent invocations.
25
+ ```ruby
26
+ stopwatch = Stopwatch.new
27
+ stopwatch.start
28
+ stopwatch.stop # Example: 3.991826
29
+ stopwatch.elapsed_time # => 3.991826
33
30
  ```
34
31
  You can also pass a list of methods that should be memoized:
35
32
  ```ruby
@@ -40,28 +37,4 @@ memoize :complex_calculation, :api_response, :db_query
40
37
  Pakiderm adds a method by using `Module#prepend` in order to"intercept" calls to the original method and provide memoization.
41
38
 
42
39
  ### Caveat
43
- If you override the method in a subclass, Pakiderm's method won't be able to intercept calls to the subclass' method.
44
-
45
- License
46
- --------
47
-
48
- Copyright (c) 2014 Máximo Mussini
49
-
50
- Permission is hereby granted, free of charge, to any person obtaining
51
- a copy of this software and associated documentation files (the
52
- "Software"), to deal in the Software without restriction, including
53
- without limitation the rights to use, copy, modify, merge, publish,
54
- distribute, sublicense, and/or sell copies of the Software, and to
55
- permit persons to whom the Software is furnished to do so, subject to
56
- the following conditions:
57
-
58
- The above copyright notice and this permission notice shall be
59
- included in all copies or substantial portions of the Software.
60
-
61
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
62
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
64
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
65
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
66
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
67
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40
+ If you override the method in a subclass, Pakiderm's method won't be able to intercept calls to the subclass' method, so you would need to call `memoize` again in the subclass.
data/lib/pakiderm.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  #
9
9
  # memoize \
10
10
  # def recent_activity
11
- # NSA.get("/api/#{person.id}")
11
+ # Activities.get("/api/#{person.id}")
12
12
  # end
13
13
  # end
14
14
  #
@@ -19,7 +19,7 @@ module Pakiderm
19
19
  #
20
20
  # Examples
21
21
  #
22
- # memoize :tired?, :complex_formula, :long_running_method!
22
+ # memoize :ready?, :complex_formula, :long_running_method!
23
23
  #
24
24
  # Returns nothing.
25
25
  def memoize(*names)
@@ -1,3 +1,3 @@
1
1
  module Pakiderm
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakiderm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-given
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files:
33
33
  - README.md
34
34
  files:
35
+ - CHANGELOG.md
35
36
  - README.md
36
37
  - lib/pakiderm.rb
37
38
  - lib/pakiderm/version.rb
@@ -39,13 +40,13 @@ homepage: https://github.com/ElMassimo/pakiderm
39
40
  licenses:
40
41
  - MIT
41
42
  metadata: {}
42
- post_install_message:
43
+ post_install_message:
43
44
  rdoc_options: []
44
45
  require_paths:
45
46
  - lib
46
47
  required_ruby_version: !ruby/object:Gem::Requirement
47
48
  requirements:
48
- - - "~>"
49
+ - - ">="
49
50
  - !ruby/object:Gem::Version
50
51
  version: '2.0'
51
52
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -54,9 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
55
  - !ruby/object:Gem::Version
55
56
  version: '0'
56
57
  requirements: []
57
- rubyforge_project:
58
- rubygems_version: 2.5.1
59
- signing_key:
58
+ rubygems_version: 3.2.3
59
+ signing_key:
60
60
  specification_version: 4
61
61
  summary: Pakiderm will never forget the return value.
62
62
  test_files: []