Sha256: 7a770675ab5977f5c555d3c00e9a7c2442e6a9dfe1c61cf0196e3287ef994ac8

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Sequel
  module Plugins
    # Adds an after_initialize hook to models, called after initializing
    # both new objects and ones loaded from the database.
    #
    # Usage:
    #
    #   # Make all model subclasses support the after_initialize hook
    #   Sequel::Model.plugin :after_initialize
    #
    #   # Make the Album class support the after_initialize hook
    #   Album.plugin :after_initialize
    module AfterInitialize
      module ClassMethods
        # Call after_initialize for model objects loaded from the database.
        #def call
        #  v = super
        #  v.after_initialize
        #  v
        #end

        private

        # REMOVE40
        def check_deprecated_after_initialize(meths)
        end
      end

      module InstanceMethods
        # Call after_initialize for new model objects.
        #def initialize(h={})
        #  super
        #  after_initialize
        #end
        
        # An empty after_initialize hook, so that plugins that use this
        # can always call super to get the default behavior.
        #def after_initialize
        #end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sequel-3.48.0 lib/sequel/plugins/after_initialize.rb