Sha256: cc3a849796355c17be3864ce477c881f9dcab19cc782990eeb33e8ceedfedc2d

Contents?: true

Size: 277 Bytes

Versions: 4

Compression:

Stored size: 277 Bytes

Contents

module SafeYAML
  class Transform
    class ToSymbol
      MATCHER = /\A:\w+\Z/.freeze

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
safe_yaml-0.8.3 lib/safe_yaml/transform/to_symbol.rb
safe_yaml-0.8.2 lib/safe_yaml/transform/to_symbol.rb
safe_yaml-0.8.1 lib/safe_yaml/transform/to_symbol.rb
safe_yaml-0.8.0 lib/safe_yaml/transform/to_symbol.rb