File: dynamic.rb

package info (click to toggle)
ruby-factory-bot 6.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,372 kB
  • sloc: ruby: 7,827; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module FactoryBot
  class Declaration
    # @api private
    class Dynamic < Declaration
      def initialize(name, ignored = false, block = nil)
        super(name, ignored)
        @block = block
      end

      def ==(other)
        self.class == other.class &&
          name == other.name &&
          ignored == other.ignored &&
          block == other.block
      end

      protected

      attr_reader :block

      private

      def build
        [Attribute::Dynamic.new(name, @ignored, @block)]
      end
    end
  end
end