类 Gem::SafeMarshal::Visitors::StreamPrinter
公共类方法
new(io, indent: "") 点击切换源码
# File rubygems/safe_marshal/visitors/stream_printer.rb, line 8 def initialize(io, indent: "") @io = io @indent = indent @level = 0 end
公共实例方法
visit(target) 点击切换源码
调用父类方法
# File rubygems/safe_marshal/visitors/stream_printer.rb, line 14 def visit(target) @io.write("#{@indent * @level}#{target.class}") target.instance_variables.each do |ivar| value = target.instance_variable_get(ivar) next if Elements::Element === value || Array === value @io.write(" #{ivar}=#{value.inspect}") end @io.write("\n") begin @level += 1 super ensure @level -= 1 end end