module Deep::Hash::Struct::PP::Wrapper
Public Instance Methods
inspect()
click to toggle source
# File lib/deep/hash/struct/pp/wrapper.rb, line 6 def inspect v = blank? ? nil : " #{to_h}" "#<#{self.class.name.split("::").last}#{v}>" end
pretty_print(q)
click to toggle source
# File lib/deep/hash/struct/pp/wrapper.rb, line 11 def pretty_print(q) if present? q.group(2, "#(#{self.class.name}:#{sprintf("0x%x", object_id)} {", "})") do q.breakable q.group(2, "{", "}") do q.breakable pretty_print_cycle(q) end q.breakable end else q.text "#(#{self.class.name}:#{sprintf("0x%x", object_id)})" end end
pretty_print_cycle(q, hash = to_h)
click to toggle source
# File lib/deep/hash/struct/pp/wrapper.rb, line 28 def pretty_print_cycle(q, hash = to_h) q.seplist(hash) do |k, v| q.text ":#{k} =>" if [String, Integer].include?(v.class) q.pp v else q.group(2, "{", "}") do q.breakable pretty_print_cycle(q, v) end end end end