In Crystal, there's two different ways to achieve similar results:
Creating a class...
class Service
def self.get
# ...
end
end
or a module extending self
:
module Service
extend self
def get
# ...
end
end
Both can invoke the method get
by Service.get
.
But when to use a class or a module? What's the difference between Crystal's classes and modules?