Sha256: ddd2a0884d5dfe2e44a2a110aac9e1157b7530f887bb8d30a03f695261ac4dc9

Contents?: true

Size: 450 Bytes

Versions: 2

Compression:

Stored size: 450 Bytes

Contents

# frozen_string_literal: true

module FakerMaker
  module LifecycleHooks
    # Lifecycle hooks which can be called during the building of an instance
    module DefinitionProxy
      def before_build(&block)
        @factory.define_singleton_method(:before_build) { yield(self.instance, self) }
      end

      def after_build(&block)
        @factory.define_singleton_method(:after_build) { yield(self.instance, self) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
faker_maker-1.2.1 lib/faker_maker/lifecycle_hooks.rb
faker_maker-1.2.0 lib/faker_maker/lifecycle_hooks.rb