mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
23 lines
306 B
Ruby
23 lines
306 B
Ruby
|
class Factory
|
||
|
|
||
|
class Attribute #:nodoc:
|
||
|
|
||
|
attr_reader :name
|
||
|
attr_writer :static_value, :lazy_block
|
||
|
|
||
|
def initialize (name)
|
||
|
@name = name
|
||
|
end
|
||
|
|
||
|
def value (proxy)
|
||
|
if @lazy_block.nil?
|
||
|
@static_value
|
||
|
else
|
||
|
@lazy_block.call(proxy)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|