Method: Virtus::AttributeSet#define_writer_method

Defined in:
lib/virtus/attribute_set.rb

#define_writer_method(attribute, method_name, visibility) ⇒ undefined

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.

Defines an attribute writer method

Parameters:

  • attribute (Attribute)
  • method_name (Symbol)
  • visibility (Symbol)

Returns:

  • (undefined)


145
146
147
148
# File 'lib/virtus/attribute_set.rb', line 145

def define_writer_method(attribute, method_name, visibility)
  define_method(method_name) { |value| attribute.set(self, value) }
  send(visibility, method_name)
end