Module: Sequel::Plugins::PrettyPrint::InstanceMethods
- Defined in:
- lib/sequel/plugins/pretty_print.rb
Instance Method Summary collapse
-
#pretty_print(pp) ⇒ Object
Modeled after the implementation within ActiveRecord.
Instance Method Details
#pretty_print(pp) ⇒ Object
Modeled after the implementation within ActiveRecord
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sequel/plugins/pretty_print.rb', line 4 def pretty_print(pp) return super if method(:inspect).owner != Sequel::Model.instance_method(:inspect).owner pp.object_address_group(self) do keys = self.class.columns.select { |name| @values.key?(name) || new? } keys = (keys + @values.keys).uniq pp.seplist(keys, proc { pp.text(",") }) do |key| pp.breakable " " pp.group(1) do pp.text key.to_s pp.text ":" pp.breakable pp.pp self[key] end end end end |