class Necromancer::ArrayConverters::ArrayToSetConverter

An object that converts an array to a set

Public Instance Methods

call(value, options = {}) 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 98
def call(value, options = {})
  strict = options.fetch(:strict, config.strict)
  begin
    value.to_set
  rescue
    strict ? fail_conversion_type(value) : value
  end
end