Socket
Book a DemoInstallSign in
Socket

mongo_method_storable

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo_method_storable

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

MongoMethodStorable

MongoMethodStorage allows you to store the output of methods in a Mongoid::Document class into MongoDB dynamic fields. It also lazily stores the output, in that the value is only stored the first time the method is called on a given object. Subsequent calls to the method will just read the attribute value from the document, eliminating the "cost" of executing the method.

Installation

Add this line to your application's Gemfile:

gem 'mongo_method_storable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mongo_method_storable

Usage

include MongoMethodStorable

def some_method
  # complex/expensive algorithm
end
mongo_store :some_method

Limitations

  • Methods can take no arguments (currently)
  • There is no option (currently) to force the method to be evaluated after the first time.
  • No tests have been written on this code (caveat: it is being used in at least one production application)
  • This is my first "real" published Ruby gem
  • A bunch of other limitations I'm sure I'll think of over time

Contributing

  • Fork it ( https://github.com/BigGillyStyle/mongo_method_storable/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 08 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.