method
pretty_print
v6.1.3.1 -
Show latest stable
- Class:
ActiveRecord::Core
pretty_print(pp)public
Takes a PP and prettily prints this record to it, allowing you to get a nice result from pp record when pp is required.
# File activerecord/lib/active_record/core.rb, line 705
def pretty_print(pp)
return super if custom_inspect_method_defined?
pp.object_address_group(self) do
if defined?(@attributes) && @attributes
attr_names = self.class.attribute_names.select { |name| _has_attribute?(name) }
pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
pp.breakable " "
pp.group(1) do
pp.text attr_name
pp.text ":"
pp.breakable
value = _read_attribute(attr_name)
value = inspection_filter.filter_param(attr_name, value) unless value.nil?
pp.pp value
end
end
else
pp.breakable " "
pp.text "not initialized"
end
end
end Related methods
- Instance methods
- <=>
- ==
- blank?
- clone
- connection_handler
- dup
- encode_with
- eql?
- freeze
- frozen?
- hash
- init_with
- init_with_attributes
- initialize_dup
- inspect
- present?
- pretty_print
- readonly!
- readonly?
- slice
- strict_loading!
- strict_loading?
- values_at
- Class methods
- allow_unsafe_raw_sql
- allow_unsafe_raw_sql=
- configurations
- configurations=
- connected_to_stack
- connection_class
- connection_class=
- connection_class?
- connection_classes
- connection_handler
- connection_handler=
- connection_handlers
- connection_handlers=
- current_preventing_writes
- current_role
- current_shard
- new
- strict_loading_violation!
- Private methods
-
custom_inspect_method_defined? -
init_internals -
initialize_internals_callback -
inspection_filter -
to_ary