# File lib/factory_girl/attribute.rb, line 36 def initialize(method_name) @method_name = method_name.to_s @method_name_setter_match = @method_name.match(/(.*)=$/) end
# File lib/factory_girl/attribute.rb, line 41 def validate! if method_is_writer? raise AttributeDefinitionError, error_message end end
# File lib/factory_girl/attribute.rb, line 53 def attribute_name @method_name_setter_match[1] end
# File lib/factory_girl/attribute.rb, line 57 def error_message "factory_girl uses '#{attribute_name} value' syntax rather than '#{attribute_name} = value'" end
# File lib/factory_girl/attribute.rb, line 49 def method_is_writer? !!@method_name_setter_match end