Class: EML::EndpointClass

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/eml/lib/endpoint_class.rb

Direct Known Subclasses

UK::EndpointClass

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_type:, resource_class:, endpoint:) ⇒ EndpointClass

Returns a new instance of EndpointClass.



24
25
26
27
28
29
# File 'lib/eml/lib/endpoint_class.rb', line 24

def initialize(class_type:, resource_class:, endpoint:)
  @class_type = T.let(class_type, String)
  @resource_class = T.let(resource_class, T.untyped)
  @endpoint = T.let(endpoint, String)
  @class_name = T.let(nil, T.nilable(String))
end

Class Method Details

.call(class_type:, resource_class:, endpoint:) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/eml/lib/endpoint_class.rb', line 12

def self.call(class_type:, resource_class:, endpoint:)
  new(
    class_type: class_type,
    resource_class: resource_class,
    endpoint: endpoint
  ).call
end

Instance Method Details

#callObject



32
33
34
# File 'lib/eml/lib/endpoint_class.rb', line 32

def call
  Object.const_get(class_name) if Object.const_defined?(class_name)
end