Class: DearInventory::EndpointClass
- Inherits:
-
Object
- Object
- DearInventory::EndpointClass
- Extended by:
- T::Sig
- Defined in:
- lib/dear_inventory/lib/endpoint_class.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(class_type:, resource_class:, endpoint:) ⇒ EndpointClass
constructor
A new instance of EndpointClass.
Constructor Details
#initialize(class_type:, resource_class:, endpoint:) ⇒ EndpointClass
Returns a new instance of EndpointClass.
32 33 34 35 36 37 |
# File 'lib/dear_inventory/lib/endpoint_class.rb', line 32 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 || "Index", String) @class_name = T.let(nil, T.nilable(String)) end |
Class Method Details
.call(class_type:, resource_class:, endpoint:) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/dear_inventory/lib/endpoint_class.rb', line 17 def self.call(class_type:, resource_class:, endpoint:) new( class_type: class_type, resource_class: resource_class, endpoint: endpoint ).call end |
Instance Method Details
#call ⇒ Object
40 41 42 |
# File 'lib/dear_inventory/lib/endpoint_class.rb', line 40 def call Object.const_get(class_name) if Object.const_defined?(class_name) end |