Sha256: 28b8b660117950b9eb05fa245ab9a4af33d7f88ae43fe600427be29ac8c1ff89
Contents?: true
Size: 1.98 KB
Versions: 4
Compression:
Stored size: 1.98 KB
Contents
# frozen_string_literal: true module ConvenientService module Core module Entities class Config module Commands class TrackMethodMissingCommitTrigger < Support::Command ## # @!attribute [r] config # @return [ConvenientService::Core::Entities::Config] # attr_reader :config ## # @!attribute [r] trigger # @return [ConvenientService::Support::UniqueValue] # attr_reader :trigger ## # @param config [ConvenientService::Core::Entities::Config] # @param trigger [ConvenientService::Support::UniqueValue] # @return [void] # def initialize(config:, trigger:) @config = config @trigger = trigger end ## # @return [void] # def call return unless method_missing_trigger_valid? return if method_missing_commits_counter_incremented? raise Exceptions::TooManyCommitsFromMethodMissing.new(config: config) end ## # @return [Boolean] # def method_missing_trigger_valid? method_missing_triggers.any?(trigger) end ## # @return [Boolean] # def method_missing_commits_counter_incremented? Utils.memoize_including_falsy_values(self, :@method_missing_commits_counter_incremented) { config.method_missing_commits_counter.bincrement } end ## # @return [Array<ConvenientService::Support::UniqueValue>] # def method_missing_triggers @method_missing_triggers ||= [ Constants::Triggers::INSTANCE_METHOD_MISSING, Constants::Triggers::CLASS_METHOD_MISSING ] end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems