Class: Eco::API::Common::Loaders::Base
- Inherits:
-
Object
- Object
- Eco::API::Common::Loaders::Base
- Extended by:
- ClassHelpers
- Defined in:
- lib/eco/api/common/loaders/base.rb
Direct Known Subclasses
Class Method Summary collapse
-
.<=>(other) ⇒ Object
Sort order.
-
.created_at ⇒ Object
Class creation timestamp, to be able to load them in the order they were declared.
-
.set_created_at! ⇒ Object
If still not set, it sets the
created_at
class timestamp.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
This method will be called when the BaseLoader is created.
- #name ⇒ Object
Methods included from ClassHelpers
class_resolver, descendants, descendants?, inheritable_attrs, inheritable_class_vars, inherited, instance_variable_name, new_class, resolve_class, to_constant
Constructor Details
#initialize ⇒ Base
Note:
- this method should implement the loading logics for the given
Children
class.
This method will be called when the BaseLoader is created
28 29 30 |
# File 'lib/eco/api/common/loaders/base.rb', line 28 def initialize raise "You should implement this method" end |
Class Method Details
.<=>(other) ⇒ Object
Sort order
10 11 12 |
# File 'lib/eco/api/common/loaders/base.rb', line 10 def <=>(other) created_at <=> other.created_at end |
.created_at ⇒ Object
Class creation timestamp, to be able to load them in the order they were declared.
20 21 22 |
# File 'lib/eco/api/common/loaders/base.rb', line 20 def created_at @created_at ||= Time.now end |
.set_created_at! ⇒ Object
If still not set, it sets the created_at
class timestamp.
15 16 17 |
# File 'lib/eco/api/common/loaders/base.rb', line 15 def set_created_at! @created_at = Time.now unless @created_at end |
Instance Method Details
#name ⇒ Object
32 33 34 |
# File 'lib/eco/api/common/loaders/base.rb', line 32 def name self.class.name end |