Project

the-blob

0.0
No commit activity in last 3 years
No release in over 3 years
The blob is an instance handling interface that seperates ORM responsibilities from application instances. This allows for fast and easy testing of your application by not needing to load ORM code in your business logic.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

The Blob

The Blob is a memory based instance storage system.

#Adding to your app

require 'the_blob'

class YourAppClass
  include TheBlob
end

Put your instances in the app/instances folder and they will be automatically loaded.

#Instances

Instances are data structures. Try to keep logic out of them or you might as well use Rails.

class YourInstance < Instance
  attr_accessors :foo, :bar
  instance_indices :index
end

class User < Instance
  instance_indices :email
end

#Inserting instances

app = YourAppClass.new
app.absorb YourInstance.new(index: "foobar")

app.absorb User.new(email: "foo@bar.com")

#Retrieving instances

app.emit_your_instance_by_index "foobar"
#=> your_instance

app.emit_user_by_email "foo@bar.com"
#=> user