Method: FormCore::VirtualModel#inspect

Defined in:
lib/form_core/virtual_model.rb

#inspectObject

Returns the contents of the record as a nicely formatted string.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/form_core/virtual_model.rb', line 8

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.collect do |name|
        "#{name}: #{attribute_for_inspect(name)}" if has_attribute?(name)
      end.compact.join(", ")
    else
      "not initialized"
    end

  "#<VirtualModel:#{self.class.name}:#{object_id} #{inspection}>"
end