GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - educabilia/ohm-identity_map: Basic identity map for Ohm.

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
lib/ohm
lib/ohm
 
 
test
test
 
 
.gitignore
.gitignore
 
 
CHANGELOG
CHANGELOG
 
 
README.md
README.md
 
 
UNLICENSE
UNLICENSE
 
 
ohm-identity_map.gemspec
ohm-identity_map.gemspec
 
 
rakefile
rakefile
 
 

Repository files navigation

Ohm::IdentityMap

Provides a basic identity map for Ohm.

Usage

require "ohm/identity_map"

# By default, no identity map is used.

Post[1].object_id == Post[1].object_id
# => false

# Enable the identity map for the duration of a block.

Ohm::Model.identity_map do
  Post[1].object_id == Post[1].object_id
end
# => true

Web

It's easy to create a Rack middleware to enable the identity map for the duration of the request/response cycle. (Such middleware may be included in this library in the future, once we test this behavior in production.)

class OhmIdentityMapMiddleware
  def initialize(app)
    @app = app
  end

  def call(env)
    Ohm::Model.identity_map { @app.call(env) }
  end
end

# config.ru or any Rack::Builder
use OhmIdentityMapMiddleware

Known issues

Currently not handling updates and deletes.

License

See UNLICENSE. With love, from Educabilia.

About

Basic identity map for Ohm.

Resources

Readme
Unlicense
Activity
Custom properties

Stars

0 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.