Class: SafeYAML::Transform::ToSymbol

Inherits:
Object
  • Object
show all
Defined in:
lib/safe_yaml/transform/to_symbol.rb

Constant Summary collapse

MATCHER =
/\A:\w+\Z/.freeze

Instance Method Summary collapse

Instance Method Details

#transform?(value) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/safe_yaml/transform/to_symbol.rb', line 6

def transform?(value)
  return false unless SafeYAML::OPTIONS[:deserialize_symbols] && MATCHER.match(value)
  return true, value[1..-1].to_sym
end