Module: ConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code::Concern::ClassMethods

Defined in:
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


38
39
40
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/class_methods.rb', line 38

def ===(other)
  Commands::IsCode.call(code: other) || super
end

#cast(other) ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code?



19
20
21
22
23
24
25
26
27
28
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/class_methods.rb', line 19

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