Sha256: 81caf3a7989a79d7fcbfb147c75ff69aa399967fd86dd5bd2b707f8cb2c579c8
Contents?: true
Size: 695 Bytes
Versions: 16
Compression:
Stored size: 695 Bytes
Contents
module Shamu module Services # Lazily look up an associated resource class LazyAssociation < Delegator # ============================================================================ # @!group Attributes # # @!attribute # @return [Object] the primary key id of the association. Not delegated so # it is safe to use and will not trigger an unnecessary fetch. attr_reader :id # # @!endgroup Attributes def initialize( id, &block ) @id = id @block = block end def __getobj__ return @association if defined? @association @association = @block.call end end end end
Version data entries
16 entries across 16 versions & 1 rubygems