A summary of data about the Ruby ecosystem.

https://github.com/matthewrudy/memoist

ActiveSupport::Memoizable with a few enhancements
https://github.com/matthewrudy/memoist

Keywords from Contributors

activejob activerecord mvc rubygems rspec static-code-analysis code-formatter rubocop rack omniauth

Last synced: about 23 hours ago
JSON representation

Repository metadata

ActiveSupport::Memoizable with a few enhancements

README.md

Memoist

Build Status

Memoist is an extraction of ActiveSupport::Memoizable.

Since June 2011 ActiveSupport::Memoizable has been deprecated.
But I love it,
and so I plan to keep it alive.

Usage

Just extend with the Memoist module

require 'memoist'
class Person
  extend Memoist

  def social_security
    puts "execute!"
    decrypt_social_security
  end
  memoize :social_security
end

person = Person.new

person.social_security
# execute!
# => (returns decrypt_social_security)

person.social_security
# => (returns the memoized value)

And person.social_security will only be calculated once.

Every memoized function (which initially was not accepting any arguments) has a (reload)
argument you can pass in to bypass and reset the memoization:

def some_method
  Time.now
end
memoize :some_method

Calling some_method will be memoized, but calling some_method(true) will rememoize each time.

You can even memoize method that takes arguments.

class Person
  def taxes_due(income)
    income * 0.40
  end
  memoize :taxes_due
end

This will only be calculated once per value of income.

You can also memoize class methods.

class Person

  class << self
    extend Memoist
    def with_overdue_taxes
      # ...
    end
    memoize :with_overdue_taxes
  end

end

When a sub-class overrides one of its parent's methods and you need to memoize both.
Then you can use the :identifier parameter in order to help Memoist distinguish between the two.

class Clock
  extend Memoist
  def now
     "The time now is #{Time.now.hour} o'clock and #{Time.now.min} minutes"
  end
  memoize :now
end

class AccurateClock < Clock
  extend Memoist
  def now
    "#{super} and #{Time.now.sec} seconds"
  end
  memoize :now, :identifier => :accurate_clock
end

Reload

Each memoized function comes with a way to flush the existing value.

person.social_security       # returns the memoized value
person.social_security(true) # bypasses the memoized value and rememoizes it

This also works with a memoized method with arguments

person.taxes_due(100_000)       # returns the memoized value
person.taxes_due(100_000, true) # bypasses the memoized value and rememoizes it

If you want to flush the entire memoization cache for an object

person.flush_cache   # returns an array of flushed memoized methods, e.g. ["social_security", "some_method"]

Authors

Everyone who contributed to it in the rails repository.

  • Joshua Peek
  • Tarmo Tänav
  • Jeremy Kemper
  • Eugene Pimenov
  • Xavier Noria
  • Niels Ganser
  • Carl Lerche & Yehuda Katz
  • jeem
  • Jay Pignata
  • Damien Mathieu
  • José Valim
  • Matthew Rudy Jacobs

Contributing

  1. Fork it ( https://github.com/matthewrudy/memoist/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Released under the MIT License, just as Ruby on Rails is.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 8 days ago

Total Commits: 105
Total Committers: 20
Avg Commits per committer: 5.25
Development Distribution Score (DDS): 0.419

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Matthew Rudy Jacobs M****s@g****m 61
Joe Rafaniello j****e@r****m 12
Seb Jacobs me@s****m 9
Peter Boling p****g@g****m 3
Zach Hale z****e@g****m 3
Igor Zubkov i****v@g****m 2
Joshua Pinter j****r@g****m 2
Brady Love and Johnneylee Jack Rollins b****y@a****t 1
Gregory Perry g****g@d****m 1
kota.nomura k****a@a****p 1
Andrey Chernih a****h@g****m 1
Brandon Zylstra b****a@g****m 1
Faraz Yashar f****r@g****m 1
Jean Boussier j****r@g****m 1
Joe Burns j****s@g****m 1
Matias Korhonen k****t@g****m 1
Olivier Lacan hi@o****m 1
PikachuEXE p****e@g****m 1
Yusuke Nakamura y****5@g****m 1
fervic r****o@r****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 3 months ago

Total issues: 43
Total pull requests: 54
Average time to close issues: 3 months
Average time to close pull requests: 19 days
Total issue authors: 38
Total pull request authors: 36
Average comments per issue: 4.05
Average comments per pull request: 2.04
Merged pull request: 30
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/matthewrudy/memoist

Top Issue Authors

  • JacobEvelyn (5)
  • findchris (2)
  • vemv (1)
  • JelF (1)
  • patbl (1)
  • omgitsbillryan (1)
  • onyxblade (1)
  • mikebaldry (1)
  • SamGerber-zz (1)
  • fny (1)
  • ansarada-dantan (1)
  • someperfectname (1)
  • kenglishhi (1)
  • nagyt234 (1)
  • ASnow (1)

Top Pull Request Authors

  • matthewrudy (8)
  • JelF (4)
  • jrafanie (4)
  • joshuapinter (2)
  • olivierlacan (2)
  • dark-panda (2)
  • edtaupier (2)
  • unasuke (2)
  • 3nan3 (1)
  • onyxblade (1)
  • fny (1)
  • JoeMcB (1)
  • andreychernih (1)
  • stevendaniels (1)
  • pboling (1)

Top Issue Labels

Top Pull Request Labels

  • breaks tests (1)

Package metadata

gem.coop: memoist

memoize methods invocation

  • Homepage: https://github.com/matthewrudy/memoist
  • Documentation: http://www.rubydoc.info/gems/memoist/
  • Licenses: MIT
  • Latest release: 0.16.2 (published over 6 years ago)
  • Last Synced: 2026-03-07T22:31:16.612Z (3 days ago)
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 306,972,578 Total
  • Docker Downloads: 581,188,093
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.059%
    • Downloads: 0.079%
    • Docker downloads count: 0.159%
  • Maintainers (2)
ubuntu-22.04: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Licenses: mit
  • Latest release: 0.16.2-2 (published 25 days ago)
  • Last Synced: 2026-02-13T13:20:19.053Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.305%
    • Stargazers count: 0.548%
    • Forks count: 0.671%
rubygems.org: memoist

memoize methods invocation

  • Homepage: https://github.com/matthewrudy/memoist
  • Documentation: http://www.rubydoc.info/gems/memoist/
  • Licenses: MIT
  • Latest release: 0.16.2 (published over 6 years ago)
  • Last Synced: 2026-03-07T13:30:33.067Z (3 days ago)
  • Versions: 15
  • Dependent Packages: 187
  • Dependent Repositories: 35,257
  • Downloads: 306,964,352 Total
  • Docker Downloads: 581,188,093
  • Rankings:
    • Downloads: 0.065%
    • Dependent repos count: 0.176%
    • Dependent packages count: 0.2%
    • Docker downloads count: 0.222%
    • Average: 0.878%
    • Stargazers count: 1.964%
    • Forks count: 2.642%
  • Maintainers (2)
proxy.golang.org: github.com/matthewrudy/memoist

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/matthewrudy/memoist#section-documentation
  • Licenses: mit
  • Latest release: v0.16.2 (published over 6 years ago)
  • Last Synced: 2026-03-06T16:00:37.159Z (4 days ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 2.102%
    • Forks count: 2.574%
    • Average: 6.263%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%
debian-11: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Documentation: https://packages.debian.org/bullseye/ruby-memoist
  • Licenses:
  • Latest release: 0.16.2-2 (published 28 days ago)
  • Last Synced: 2026-02-13T08:22:04.315Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-20.04: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Licenses:
  • Latest release: 0.16.2-2 (published 25 days ago)
  • Last Synced: 2026-02-13T07:17:32.602Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.10: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Licenses:
  • Latest release: 0.16.2-3 (published 25 days ago)
  • Last Synced: 2026-02-13T18:25:25.753Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-10: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Documentation: https://packages.debian.org/buster/ruby-memoist
  • Licenses:
  • Latest release: 0.16.0-2 (published 27 days ago)
  • Last Synced: 2026-02-13T04:22:52.203Z (26 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.04: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Licenses:
  • Latest release: 0.16.2-3 (published 27 days ago)
  • Last Synced: 2026-02-11T06:43:10.234Z (27 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Documentation: https://packages.debian.org/bookworm/ruby-memoist
  • Licenses:
  • Latest release: 0.16.2-3 (published 26 days ago)
  • Last Synced: 2026-02-12T23:34:53.439Z (26 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-24.10: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Licenses:
  • Latest release: 0.16.2-3 (published 29 days ago)
  • Last Synced: 2026-02-09T16:53:44.400Z (29 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-24.04: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Licenses:
  • Latest release: 0.16.2-3 (published about 1 month ago)
  • Last Synced: 2026-03-06T16:00:55.081Z (4 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-13: ruby-memoist

  • Homepage: https://github.com/matthewrudy/memoist
  • Documentation: https://packages.debian.org/trixie/ruby-memoist
  • Licenses:
  • Latest release: 0.16.2-3 (published 26 days ago)
  • Last Synced: 2026-02-13T13:17:25.948Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%

Dependencies

memoist.gemspec rubygems
  • benchmark-ips >= 0 development
  • bundler >= 0 development
  • minitest ~> 5.10 development
  • rake >= 0 development
  • rake ~> 10.4 development
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
Gemfile rubygems

Score: 31.153173964708927