Class: FactoryGirl::Attribute::NonAttributeWriterValidator Private

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_girl/attribute.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(method_name) ⇒ NonAttributeWriterValidator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of NonAttributeWriterValidator.



36
37
38
39
# 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

Instance Method Details

#validate!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
44
45
# File 'lib/factory_girl/attribute.rb', line 41

def validate!
  if method_is_writer?
    raise AttributeDefinitionError, error_message
  end
end