Sha256: 003036f161799d2d60d2587c38eaddc6d51259cd2c9a8f9788b3f58615d02e74
Contents?: true
Size: 746 Bytes
Versions: 54
Compression:
Stored size: 746 Bytes
Contents
module FactoryGirl class Callback attr_reader :name def initialize(name, block) @name = name.to_sym @block = block check_name end def run(instance, evaluator) case block.arity when 1 then block.call(instance) when 2 then block.call(instance, evaluator) else block.call end end def ==(other) name == other.name && block == other.block end protected attr_reader :block private def check_name unless FactoryGirl.callback_names.include?(name) raise InvalidCallbackNameError, "#{name} is not a valid callback name. " + "Valid callback names are #{FactoryGirl.callback_names.inspect}" end end end end
Version data entries
54 entries across 54 versions & 4 rubygems