class Psych::Coder
called, respectively.
objects like Sequence and Scalar may be emitted if seq=
or scalar=
are
automatically assumes a Psych::Nodes::Mapping is being emitted. Other
be passed to the method when the object is being serialized. The Coder
If an object defines encode_with
, then an instance of Psych::Coder will
##
def [] k
def [] k @type = :map @map[k] end
def []= k, v
def []= k, v @type = :map @map[k] = v end
def initialize tag
def initialize tag @map = {} @seq = [] @implicit = false @type = :map @tag = tag @style = Psych::Nodes::Mapping::BLOCK @scalar = nil @object = nil end
def map tag = @tag, style = @style
def map tag = @tag, style = @style @tag = tag @style = style yield self if block_given? @map end
def map= map
def map= map @type = :map @map = map end
def represent_map tag, map
def represent_map tag, map @tag = tag self.map = map end
def represent_object tag, obj
def represent_object tag, obj @tag = tag @type = :object @object = obj end
def represent_scalar tag, value
def represent_scalar tag, value self.tag = tag self.scalar = value end
def represent_seq tag, list
def represent_seq tag, list @tag = tag self.seq = list end
def scalar *args
def scalar *args if args.length > 0 warn "#{caller[0]}: Coder#scalar(a,b,c) is deprecated" if $VERBOSE @tag, @scalar, _ = args @type = :scalar end @scalar end
def scalar= value
def scalar= value @type = :scalar @scalar = value end
def seq= list
def seq= list @type = :seq @seq = list end