Class: ConvenientService::Core::Entities::Config::Commands::TrackMethodMissingCommitTrigger
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Core::Entities::Config::Commands::TrackMethodMissingCommitTrigger
- Defined in:
- lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
- #call ⇒ void
- #initialize(config:, trigger:) ⇒ void constructor
- #method_missing_commits_counter_incremented? ⇒ Boolean
- #method_missing_trigger_valid? ⇒ Boolean
- #method_missing_triggers ⇒ Array<ConvenientService::Support::UniqueValue>
Methods inherited from Support::Command
Constructor Details
#initialize(config:, trigger:) ⇒ void
26 27 28 29 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 26 def initialize(config:, trigger:) @config = config @trigger = trigger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 13 def config @config end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
19 20 21 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 19 def trigger @trigger end |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
34 35 36 37 38 39 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 34 def call return unless method_missing_trigger_valid? return if method_missing_commits_counter_incremented? ::ConvenientService.raise Exceptions::TooManyCommitsFromMethodMissing.new(config: config) end |
#method_missing_commits_counter_incremented? ⇒ Boolean
51 52 53 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 51 def method_missing_commits_counter_incremented? Utils.memoize_including_falsy_values(self, :@method_missing_commits_counter_incremented) { config.method_missing_commits_counter.bincrement } end |
#method_missing_trigger_valid? ⇒ Boolean
44 45 46 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 44 def method_missing_trigger_valid? method_missing_triggers.any?(trigger) end |
#method_missing_triggers ⇒ Array<ConvenientService::Support::UniqueValue>
58 59 60 61 62 63 |
# File 'lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb', line 58 def method_missing_triggers @method_missing_triggers ||= [ Constants::Triggers::INSTANCE_METHOD_MISSING, Constants::Triggers::CLASS_METHOD_MISSING ] end |