class Highway::Steps::Types::Set
This class represents a set parameter type. It's like array but ensures the values occur only once.
Public Instance Methods
typecheck(value)
click to toggle source
Typecheck and coerce a value if possible.
This method returns a typechecked and coerced value or `nil` if value has invalid type and can't be coerced.
@param value [Object] A value.
@return [Set, nil]
Calls superclass method
Highway::Steps::Types::Array#typecheck
# File lib/highway/steps/types/set.rb, line 28 def typecheck(value) typechecked_array = super(value) return nil if typechecked_array == nil typechecked_set = ::Set.new(typechecked_array) typechecked_set if typechecked_set.count == typechecked_array.count end