2017-10-20 15:20:28 -04:00
|
|
|
module FactoryBot
|
2011-09-23 13:14:02 -04:00
|
|
|
class Declaration
|
2012-05-05 02:31:31 -04:00
|
|
|
# @api private
|
2011-09-23 13:14:02 -04:00
|
|
|
class Dynamic < Declaration
|
2011-10-09 17:07:05 -04:00
|
|
|
def initialize(name, ignored = false, block = nil)
|
2011-10-07 18:19:27 -04:00
|
|
|
super(name, ignored)
|
2011-09-23 13:14:02 -04:00
|
|
|
@block = block
|
|
|
|
end
|
|
|
|
|
2011-10-14 15:14:43 -04:00
|
|
|
def ==(other)
|
2018-10-21 17:14:46 -04:00
|
|
|
self.class == other.class &&
|
|
|
|
name == other.name &&
|
2011-10-14 15:14:43 -04:00
|
|
|
ignored == other.ignored &&
|
|
|
|
block == other.block
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
2018-09-27 21:35:05 -04:00
|
|
|
|
2011-10-14 15:14:43 -04:00
|
|
|
attr_reader :block
|
|
|
|
|
2011-09-23 13:14:02 -04:00
|
|
|
private
|
|
|
|
|
|
|
|
def build
|
2011-10-07 18:19:27 -04:00
|
|
|
[Attribute::Dynamic.new(name, @ignored, @block)]
|
2011-09-23 13:14:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|