Module: Sequel::Plugins::PrettyPrint::InstanceMethods
- Defined in:
- lib/sequel/plugins/pretty_print.rb
Instance Method Summary collapse
-
#pretty_print(pp) ⇒ Object
Mimics the ActiveRecord’s implementation.
Instance Method Details
#pretty_print(pp) ⇒ Object
Mimics the ActiveRecord’s implementation
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sequel/plugins/pretty_print.rb', line 6 def pretty_print(pp) if method(:inspect).owner != Sequel::Model.instance_method(:inspect).owner return super end 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 |