Method: Formed::Base#inspect

Defined in:
lib/formed/base.rb

#inspectObject



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/formed/base.rb', line 114

def inspect
  # We check defined?(@attributes) not to issue warnings if the object is
  # allocated but not initialized.
  inspection = if defined?(@attributes) && @attributes
                 self.class.attribute_names.filter_map do |name|
                   "#{name}: #{_read_attribute(name).inspect}" if self.class.attribute_types.key?(name)
                 end.join(", ")
               else
                 "not initialized"
               end

  "#<#{self.class} #{inspection}>"
end