Module: Poro::Persistify

Defined in:
lib/poro/persistify.rb

Overview

Include this module into any class in order to flag it for persistence.

This is the only required change to a class in order to make it persistent. This flags it so that the factories know that it is okay to generate a context for this class and persist it.

The only method this adds is a convenience class method for configuring the Context instance that backs the class it is included in.

This module represents the only required breech of the hands off your code philosophy that Poro embodies.

For those looking to add more model like behaviors, include Poro::Modelify as well.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object

:nodoc:



18
19
20
21
22
23
24
25
# File 'lib/poro/persistify.rb', line 18

def self.included(mod) # :nodoc:
  mod.send(:extend, ClassMethods)
  
  # Force the initialization of the context now, as one would expect it to
  # exist after including this module.  This also makes sure that on load
  # all the contexts that are going to exist are known for introspection.
  Context.fetch(mod)
end