Project

General

Profile

Actions

Bug #6205

closed

YAML Regexp in anchor gets converted to String

Added by giddie (Paul Dann) about 13 years ago. Updated about 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
Backport:
[ruby-core:43681]

Description

I'll try to illustrate with code:

YAML:

hello: &allow-float
!ruby/regexp '/hello/'
bla: *allow-float

RUBY:
require 'yaml'

config = YAML.load_file('config.yaml')
puts config.inspect
puts config['hello'].class
puts config['bla'].class

OUTPUT:
{"hello"=>/hello/, "bla"=>"/hello/"}
Regexp
String

The Regexp has become a string. This only seems to happen if the Regexp is at the root of the anchor.

This happens with Ruby 1.9.3p0, but not with 1.9.2p290.

Actions

Also available in: Atom PDF

Like0
Like0