class Necromancer::ArrayConverters::ArrayToSetConverter

An object that converts an array to a set

Public Instance Methods

call(value, strict: config.strict) click to toggle source

Convert an array to a set

@example

converter.call([:x, :y, :x, 1, 2, 1])  # => <Set: {:x, :y, 1, 2}>

@param [Array] value

the array to convert

@api public

# File lib/necromancer/converters/array.rb, line 177
def call(value, strict: config.strict)
  value.to_set
rescue StandardError
  strict ? raise_conversion_type(value) : value
end