psych icon indicating copy to clipboard operation
psych copied to clipboard

`ruby/object:*` tag not used for scalar value

Open singpolyma opened this issue 6 years ago • 0 comments

class Custom
    def initialize
      @value = 1
    end

    def encode_with(coder)
      coder.scalar = @value.to_s
    end

    def init_with(coder)
      @value = coder.scalar.to_i
    end
end

YAML::load(YAML::dump(Custom.new)) # => 1

Would expect that to return a Custom since dump emits the correct tag, bug instead get 1

singpolyma avatar Apr 26 '19 01:04 singpolyma