Sha256: f51e0a9c2eae5639e3830b2cbb7b0b0c0d82f7969a15ab582f9d1699b8be4297
Contents?: true
Size: 1.02 KB
Versions: 9
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Miteru # # Base class for services # class Service include Dry::Monads[:result, :try] def call(*args, **kwargs) raise NotImplementedError, "You must implement #{self.class}##{__method__}" end def result(...) Try[StandardError] { call(...) }.to_result end class << self def call(...) new.call(...) end def result(...) new.result(...) end end private def auto_download? Miteru.config.auto_download end # # @return [SemanticLogger] # def logger Miteru.logger end def cache? Miteru.cache? end def sidekiq? Miteru.sidekiq? end # # @return [Miteru::Cache] # def cache Miteru.cache end def threads Miteru.config.threads end def verbose? Miteru.config.verbose end def cache_prefix Miteru.config.cache_prefix end def cache_ex Miteru.config.cache_ex end end end
Version data entries
9 entries across 9 versions & 1 rubygems