Class: Yes::Core::CommandHandling::StateUpdater::BlockAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/yes/core/command_handling/state_updater.rb

Overview

Helper class to analyze the update_state block at definition time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBlockAnalyzer

Returns a new instance of BlockAnalyzer.



36
37
38
# File 'lib/yes/core/command_handling/state_updater.rb', line 36

def initialize
  @updated_attributes = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *_args) { ... } ⇒ void

This method returns an undefined value.

Parameters:

  • method_name (Symbol)

    The method being called

  • args (Array)

    Method arguments (unused)

Yields:

  • Optional block to evaluate for attribute value

Yield Returns:

  • (void)


45
46
47
# File 'lib/yes/core/command_handling/state_updater.rb', line 45

def method_missing(method_name, *_args, &block)
  @updated_attributes << method_name if block
end

Instance Attribute Details

#updated_attributesObject (readonly)

Returns the value of attribute updated_attributes.



34
35
36
# File 'lib/yes/core/command_handling/state_updater.rb', line 34

def updated_attributes
  @updated_attributes
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/yes/core/command_handling/state_updater.rb', line 49

def respond_to_missing?(*, **)
  true
end