Module: Virtus::ClassMethods

Includes:
ConstMissingExtensions, Extensions::Methods
Defined in:
lib/virtus/class_methods.rb

Overview

Class methods that are added when you include Virtus

Instance Method Summary collapse

Methods included from ConstMissingExtensions

#const_missing

Methods included from Extensions::Methods

#allowed_writer_methods, #attribute, #values

Instance Method Details

#attribute_setAttributeSet

Returns all the attributes defined on a Class

Examples:

class User
  include Virtus

  attribute :name, String
  attribute :age,  Integer
end

User.attribute_set  # =>

TODO: implement inspect so the output is not cluttered - solnic

Returns:


38
39
40
# File 'lib/virtus/class_methods.rb', line 38

def attribute_set
  @attribute_set
end

#attributesObject

Deprecated.

See Also:

  • attribute_set

47
48
49
50
# File 'lib/virtus/class_methods.rb', line 47

def attributes
  warn "#{self}.attributes is deprecated. Use #{self}.attribute_set instead: #{caller.first}"
  attribute_set
end