Sha256: 6bcac33c47e4d7c69cd55167434d7db5bd61ac5c68b293019dc91859b524e54a

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

module FactoryBot
  class Decorator
    class InvocationTracker < Decorator
      def initialize(component)
        super
        @invoked_methods = []
      end

      if ::Gem::Version.new(::RUBY_VERSION) >= ::Gem::Version.new("2.7")
        def method_missing(name, *args, **kwargs, &block) # rubocop:disable Style/MissingRespondToMissing
          @invoked_methods << name
          super
        end
      else
        def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
          @invoked_methods << name
          super
        end
      end

      def __invoked_methods__
        @invoked_methods.uniq
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factory_bot-6.1.0 lib/factory_bot/decorator/invocation_tracker.rb