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

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

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


36
37
38
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/class_methods.rb', line 36

def ===(other)
  Commands::IsData.call(data: other) || super
end

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



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

def cast(other)
  case other
  when ::Hash
    new(value: other.transform_keys(&:to_sym))
  when Data
    new(value: other.value)
  end
end