Module: ConvenientService::Service::Configs::Standard Private

Includes:
Config, ConvenientService::Service::Core
Defined in:
lib/convenient_service/service/configs/standard.rb,
lib/convenient_service/service/configs/standard/v1.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Default configuration for the user-defined services.

Since:

  • 1.0.0

Defined Under Namespace

Modules: V1

Class Method Summary collapse

Methods included from Core

entity?, entity_class?

Methods included from ConvenientService::Support::Concern

included

Methods included from Config

empty_options, included

Class Method Details

.service?(service) ⇒ Boolean

Checks whether an object is a service instance.

Examples:

Simple usage.

class Service
  include ConvenientService::Standard::Config

  def result
    success
  end
end

ConvenientService::Service::Configs::Standard.service?(Service.new)
# => true

ConvenientService::Service::Configs::Standard.service?(Service)
# => false

ConvenientService::Service::Configs::Standard.service?(42)
# => false

Parameters:

  • service (Object)

    Can be any type.

Returns:

  • (Boolean)

Since:

  • 1.0.0



445
446
447
# File 'lib/convenient_service/service/configs/standard.rb', line 445

def service?(service)
  service_class?(service.class)
end

.service_class?(service_class) ⇒ Boolean

Checks whether a class is a service class.

Examples:

Simple usage.

class Service
  include ConvenientService::Standard::Config

  def result
    success
  end
end

ConvenientService::Service::Configs::Standard.service_class?(Service)
# => true

ConvenientService::Service::Configs::Standard.service_class?(Service.new)
# => false

ConvenientService::Service::Configs::Standard.service_class?(42)
# => false

Parameters:

  • service_class (Object)

    Can be any type.

Returns:

  • (Boolean)

Since:

  • 1.0.0



413
414
415
416
417
# File 'lib/convenient_service/service/configs/standard.rb', line 413

def service_class?(service_class)
  return false unless service_class.instance_of?(::Class)

  service_class.include?(Service::Core)
end