lib/virtus/class_methods.rb
# Returns all the attributes defined on a Class
#
# @example
#   class User
#     include Virtus
#
#     attribute :name, String
#     attribute :age,  Integer
#   end
#
#   User.attributes  # =>
#
#   TODO: implement inspect so the output is not cluttered - solnic
#
# @return [AttributeSet]
#
# @api public
Returns all the attributes defined on a Class
Returns all the attributes defined on a Class
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
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
Returns all the attributes defined on a Class
Returns all the attributes defined on a Class
None
AttributeSet
example
class User include Virtus attribute :name, String attribute :age, Integer end User.attributes # => TODO: implement inspect so the output is not cluttered - solnic
class User include Virtus attribute : name String attribute : age Integer end User . attributes # = > TODO : implement inspect so the output is not cluttered - solnic
api
None