Module: ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Type::Concern

Includes:
Support::Concern
Defined in:
lib/convenient_service/common/plugins/can_have_callbacks/entities/type/concern.rb

Class Method Summary collapse

Class Method Details

.cast(other) ⇒ ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Type?

Parameters:

  • other (Object)

    Can be any type.

Returns:



17
18
19
20
21
22
23
24
25
26
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type/concern.rb', line 17

def cast(other)
  case other
  when ::Symbol
    Type.new(value: other)
  when ::String
    Type.new(value: other.to_sym)
  when Type
    Type.new(value: other.value)
  end
end