class SafeYAML::Transform::ToSymbol

Public Instance Methods

transform?(value, options=SafeYAML::OPTIONS) click to toggle source
# File lib/safe_yaml/transform/to_symbol.rb, line 4
def transform?(value, options=SafeYAML::OPTIONS)
  if options[:deserialize_symbols] && value =~ /\A:./
    if value =~ /\A:(["'])(.*)\1\Z/
      return true, $2.sub(/^:/, "").to_sym
    else
      return true, value.sub(/^:/, "").to_sym
    end
  end

  return false
end