Sha256: af02874cd9138101ba59a3f0f0921142494f89a55e2edd80ca54c7cb339cbf72
Contents?: true
Size: 652 Bytes
Versions: 2
Compression:
Stored size: 652 Bytes
Contents
require 'active_support/concern' require 'active_support/core_ext/module/delegation' module MemoryModel class Base module Collectible extend ActiveSupport::Concern extend ConcernedInheritance inherited do instance_variable_set :@collection, baseclass.collection end module ClassMethods delegate *(MemoryModel::Collection.instance_methods - Object.instance_methods), to: :collection delegate :first, :last, to: :all def collection return nil if self == MemoryModel::Base @collection ||= MemoryModel::Collection.new(self) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
memory_model-1.0.0 | lib/memory_model/base/collectible.rb |
memory_model-0.1.0 | lib/memory_model/base/collectible.rb |