Class: Parameters::Types::Set

Inherits:
Array show all
Defined in:
lib/parameters/types/set.rb

Instance Attribute Summary

Attributes inherited from Array

#element_type

Class Method Summary collapse

Methods inherited from Array

#==, #===, #coerce, element_type, #initialize, #to_ruby

Methods inherited from Object

#===, ===, to_ruby

Methods inherited from Type

#<, #<=, #==, ===, #===, #coerce, #to_ruby, to_ruby

Constructor Details

This class inherits a constructor from Parameters::Types::Array

Class Method Details

.coerce(value) ⇒ ::Set

Coerces a value into a Set.

Parameters:

  • value (#to_set, ::Object)

    The value to coerce.

Returns:

  • (::Set)

    The coerced Set.



18
19
20
21
22
23
24
# File 'lib/parameters/types/set.rb', line 18

def self.coerce(value)
  if value.respond_to?(:to_set)
    value.to_set
  else
    ::Set[value]
  end
end