Class: Eco::API::Common::Loaders::Base

Inherits:
Object
  • Object
show all
Extended by:
ClassHelpers
Includes:
Language::AuxiliarLogger
Defined in:
lib/eco/api/common/loaders/base.rb

Direct Known Subclasses

CaseBase

Instance Attribute Summary

Attributes included from Language::AuxiliarLogger

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassHelpers

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

Methods included from Language::AuxiliarLogger

#log

Constructor Details

#initializeBase

Note:
  • this method should implement the loading logics for the given Children class.

This method will be called when the BaseLoader is created



29
30
31
# File 'lib/eco/api/common/loaders/base.rb', line 29

def initialize
  raise "You should implement this method"
end

Class Method Details

.<=>(other) ⇒ Object

Sort order



11
12
13
# File 'lib/eco/api/common/loaders/base.rb', line 11

def <=>(other)
  created_at <=> other.created_at
end

.created_atObject

Class creation timestamp, to be able to load them in the order they were declared.



21
22
23
# File 'lib/eco/api/common/loaders/base.rb', line 21

def created_at
  @created_at ||= Time.now
end

.set_created_at!Object

If still not set, it sets the created_at class timestamp.



16
17
18
# File 'lib/eco/api/common/loaders/base.rb', line 16

def set_created_at!
  @created_at ||= Time.now unless @created_at # rubocop:disable Naming/MemoizedInstanceVariableName
end