From fefac6f55cdd4a6f143124566b02c0c8de662781 Mon Sep 17 00:00:00 2001 From: Chris Salzberg Date: Mon, 4 Jul 2022 21:40:17 +0900 Subject: [PATCH] Release 0.2.0 --- .gitignore | 2 ++ CHANGELOG.md | 12 ++++++++++++ README.md | 23 ++++++++++++++++++++--- lib/michie/version.rb | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.gitignore b/.gitignore index 8eb3b06..d503744 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ # rspec failure tracking .rspec_status + +*.gem diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..602f1ae --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Michie Changelog + +## 0.x + +### 0.2.0 + +- Support passing method names to `memoize` +- Use method type prefix to avoid instance variable name collisions + +### 0.1.0 + +Initial release. diff --git a/README.md b/README.md index 0eb959b..1ce9d0c 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ [gem]: https://rubygems.org/gems/michie [actions]: https://github.com/shioyama/michie/actions -Michie (pronounced /ˈmɪki/, like “Mickey”) memoizes methods defined in a block. -Unlike other meomization libraries, Michie encapsulates its memoization in -a single module which it prepends over the original method. +Michie (pronounced /ˈmɪki/, like “Mickey”) memoizes methods either passed by +method name or defined in a block. Unlike other meomization libraries, Michie +encapsulates its memoization in a single module which it prepends over the +original method. ## Usage @@ -25,6 +26,22 @@ class BillingApi end end end +``` + +Alternatively, you can pass the method name(s) to `memoize` after they have +been defined: + +```ruby +class BillingApi + extend Michie + + def fetch_aggregate_data + # returns all data from remote server + end + memoize :fetch_aggregate_data +end +``` + api = BillingApi.new api.fetch_aggregate_data diff --git a/lib/michie/version.rb b/lib/michie/version.rb index f8317d4..2accaa2 100644 --- a/lib/michie/version.rb +++ b/lib/michie/version.rb @@ -1,3 +1,3 @@ module Michie - VERSION = "0.1.0" + VERSION = "0.2.0" end