module MessagePack::Inspect::YAMLStreamer
Public Class Methods
object(io, depth, index) { || ... }
click to toggle source
# File lib/msgpack/inspect/streamer.rb, line 35 def self.object(io, depth, index) yield end
objects(io, depth) { || ... }
click to toggle source
# File lib/msgpack/inspect/streamer.rb, line 30 def self.objects(io, depth) io.puts "---" if depth == 0 yield end
Public Instance Methods
attributes(io)
click to toggle source
Calls superclass method
# File lib/msgpack/inspect/streamer.rb, line 70 def attributes(io) write(:format, :header) super write(:error) if @error case @format when :fixint, :uint8, :uint16, :uint32, :uint64, :int8, :int16, :int32, :int64 write(:data, :value) when :fixmap, :map16, :map32 write(:length) when :fixarray, :array16, :array32 write(:length) when :fixstr, :str8, :str16, :str32 write(:length, :data, :value) when :nil write(:data, :value) when :false write(:data, :value) when :true write(:data, :value) when :bin8, :bin16, :bin32 write(:length, :data, :value) when :ext8, :ext16, :ext32, :fixext1, :fixext2, :fixext4, :fixext8, :fixext16 if @value write(:exttype, :length, :data, :value) else write(:exttype, :length, :data) end when :float32, :float64 write(:data, :value) when :never_used write(:data) end end
element_key()
click to toggle source
Calls superclass method
# File lib/msgpack/inspect/streamer.rb, line 117 def element_key @io.puts %!#{indent} - key:! super end
element_value()
click to toggle source
Calls superclass method
# File lib/msgpack/inspect/streamer.rb, line 122 def element_value @io.puts %!#{indent} value:! super end
elements(&block)
click to toggle source
Calls superclass method
# File lib/msgpack/inspect/streamer.rb, line 107 def elements(&block) if @length == 0 @io.puts %!#{indent}children: []! return end @io.puts %!#{indent}children:! super end
indent(head = false)
click to toggle source
# File lib/msgpack/inspect/streamer.rb, line 39 def indent(head = false) if head " " * (@depth - 1) + "- " else " " * @depth end end
write(*attrs)
click to toggle source
# File lib/msgpack/inspect/streamer.rb, line 47 def write(*attrs) attrs.each do |attr| case attr when :format @io.puts %!#{indent(@heading)}format: "#{@format.to_s}"! when :header @io.puts %!#{indent}header: "0x#{hex(@header)}"! when :data @io.puts %!#{indent}data: "0x#{@data}"! when :value if @value.nil? @io.puts %!#{indent}value: null! else @io.puts %!#{indent}value: #{@value.inspect}! end when :length @io.puts %!#{indent}length: #{@length}! when :exttype @io.puts %!#{indent}exttype: #{@exttype}! end end end