Module: Virtus::ClassMethods
- Includes:
- Extensions
- Defined in:
- lib/virtus/class_methods.rb
Overview
Class methods that are added when you include Virtus
Constant Summary
Constants included from Extensions
Extensions::INVALID_WRITER_METHODS, Extensions::WRITER_METHOD_REGEXP
Instance Method Summary collapse
-
#attribute_set ⇒ AttributeSet
Returns all the attributes defined on a Class.
- #attributes ⇒ Object deprecated Deprecated.
-
#const_missing(name) ⇒ Class
private
Hooks into const missing process to determine types of attributes.
Methods included from Extensions
#allowed_writer_methods, #attribute
Instance Method Details
#attribute_set ⇒ AttributeSet
Returns all the attributes defined on a Class
41 42 43 44 45 46 47 |
# File 'lib/virtus/class_methods.rb', line 41 def attribute_set return @attribute_set if defined?(@attribute_set) superclass = self.superclass method = __method__ parent = superclass.public_send(method) if superclass.respond_to?(method) @attribute_set = AttributeSet.new(parent) end |
#attributes ⇒ Object
Deprecated.
54 55 56 57 |
# File 'lib/virtus/class_methods.rb', line 54 def attributes warn "#{self}.attributes is deprecated. Use #{self}.attribute_set instead: #{caller.first}" attribute_set end |
#const_missing(name) ⇒ Class
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.
Hooks into const missing process to determine types of attributes
66 67 68 |
# File 'lib/virtus/class_methods.rb', line 66 def const_missing(name) Attribute.determine_type(name) or super end |