lib/cistern/formatter/awesome_print.rb in cistern-2.8.0 vs lib/cistern/formatter/awesome_print.rb in cistern-2.8.1

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'awesome_print' module Cistern::Formatter::AwesomePrint def self.call(model) model.ai @@ -25,17 +27,19 @@ end # Format Cistern::Model #------------------------------------------------------------------------------ def awesome_cistern_model(object) - data = object.attributes.keys.sort.each_with_object({}) { |e, a| a[e] = object.public_send(e) } - "#{object} " << awesome_hash(data) + data = object.attributes.keys.sort.each_with_object({}) do |e, a| + a[e] = object.read_attribute(e) + end + "#{object} #{awesome_hash(data)}" end # Format Cistern::Model #------------------------------------------------------------------------------ def awesome_cistern_collection(object) - "#{object.class.name} " << awesome_hash(attributes: object.attributes, records: object.to_a) + "#{object.class.name} #{awesome_hash(attributes: object.attributes, records: object.to_a)}" end end AwesomePrint::Formatter.send(:include, AwesomePrint::Cistern)