memo-it 0.1.1 → 0.1.2

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/README.md +1 -1
  4. data/lib/memo/it.rb +4 -3
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc692fd05221a47c253e0ed6ab911438bc6d08f0
4
- data.tar.gz: f5de412a7dc176141152188cded12f385ff9bcc5
3
+ metadata.gz: a8f78c7a50e8cbad98d26701c1e0f28a65787594
4
+ data.tar.gz: f43cb631b0416a4188c51f11c301d3db6a0f7599
5
5
  SHA512:
6
- metadata.gz: 9083290b6f5ad32e99b825c6627fc73bc06d6c091b1e74f81abcde8c454a73cb77f6f38301cd7f510a493ca766ddfb70ae02739006d21a4769c899725c7bb3d0
7
- data.tar.gz: 222961a4fb405fa8815d122b8d5d2ca0de1a45e6ce86b013d732290d12108804bbfc3f2afd3b3c18497343da232db1af88a1c01f5dc9d0b10b0aac44f556bad0
6
+ metadata.gz: 05bdef9d4e2e040ac5906fe6b8cd879a337e92ebe591400abfa492a2a0b8663c44b8734edc179d3e7d850ea549488828c35d5025abf30649d19ed2b1e25b04bc
7
+ data.tar.gz: 89d151fee8ec8a53ee5fb3fc8e6fc8509bc44ed6422e583b04cc1180203e19e2b48a652cbe69693a3fac0be6053d987b1345986623275287de01db5dee61f0a0
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  sudo: false
2
- language: ruby
3
2
  rvm:
3
+ - 2.3.0
4
4
  - 2.4.0
5
- before_install: gem install bundler -v 1.13.7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Memo::It
2
2
 
3
- Clever memoization helper that uses Ruby internals instead of meta-programming.
3
+ Clever memoization helper that uses Ruby internals instead of meta-programming. [![Build Status](https://travis-ci.org/phoet/memo-it.svg?branch=master)](https://travis-ci.org/phoet/memo-it)
4
4
 
5
5
  ## Usage
6
6
 
data/lib/memo/it.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  module Memo
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  module It
4
4
  def memo(&block)
5
5
  keys = block.source_location
6
- keys << block.binding.local_variables.map { |name| [name, block.binding.local_variable_get(name).to_s] }
6
+ keys << block.binding.local_variables.map { |name| [name, block.binding.local_variable_get(name)] }
7
+ keys = keys.flatten.map(&:to_s)
7
8
 
8
9
  @_memo_it ||= {}
9
- @_memo_it[keys] if @_memo_it.key? keys
10
+ return @_memo_it[keys] if @_memo_it.key? keys
10
11
  @_memo_it[keys] = yield
11
12
  end
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memo-it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - phoet