Class: Eco::API::UseCases::BaseCase

Inherits:
Object
  • Object
show all
Extended by:
Common::ClassHelpers
Defined in:
lib/eco/api/usecases/base_case.rb

Overview

Core class of UseCases. It basically defines and manages allowed types

Direct Known Subclasses

BaseIO, UseCase

Defined Under Namespace

Classes: InvalidType

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Common::ClassHelpers

class_resolver, descendants, descendants?, inheritable_attrs, inheritable_class_vars, inherited, instance_variable_name, new_class, resolve_class, to_constant

Class Attribute Details

.typesObject (readonly)

Returns the value of attribute types.



27
28
29
# File 'lib/eco/api/usecases/base_case.rb', line 27

def types
  @types
end

Class Method Details

.valid_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/eco/api/usecases/base_case.rb', line 29

def valid_type?(type)
  types.include?(type)
end

.validate_type(type) ⇒ Object

Raises:



33
34
35
# File 'lib/eco/api/usecases/base_case.rb', line 33

def validate_type(type)
  raise InvalidType.new(type: type, types: types) unless valid_type?(type)
end