Module: ActiveAttr::TypecastedAttributes::ClassMethods

Defined in:
lib/active_attr/typecasted_attributes.rb

Overview

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#inspectString

Returns the class name plus its attribute names and types

Examples:

Inspect the model’s definition.

Person.inspect

Returns:

  • (String)

    Human-readable presentation of the attributes

Since:

  • 0.5.0



88
89
90
91
92
# File 'lib/active_attr/typecasted_attributes.rb', line 88

def inspect
  inspected_attributes = attribute_names.sort.map { |name| "#{name}: #{_attribute_type(name)}" }
  attributes_list = "(#{inspected_attributes.join(", ")})" unless inspected_attributes.empty?
  "#{name}#{attributes_list}"
end