Class: Rails::Worktrees::ProjectConfigurationLoader::AssignmentRecorder
- Inherits:
-
Object
- Object
- Rails::Worktrees::ProjectConfigurationLoader::AssignmentRecorder
- Defined in:
- lib/rails/worktrees/project_configuration_loader.rb
Overview
Records config.
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(configuration = nil) ⇒ AssignmentRecorder
constructor
A new instance of AssignmentRecorder.
- #method_missing(method_name, *args) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(configuration = nil) ⇒ AssignmentRecorder
Returns a new instance of AssignmentRecorder.
153 154 155 156 |
# File 'lib/rails/worktrees/project_configuration_loader.rb', line 153 def initialize(configuration = nil) @configuration = configuration @values = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/rails/worktrees/project_configuration_loader.rb', line 158 def method_missing(method_name, *args) name = method_name.to_s if setter_call?(name, args) values[name.delete_suffix('=').to_sym] = args.first elsif getter_call?(name, args) values.fetch(name.to_sym) { configuration_value_for(method_name) } else super end end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
151 152 153 |
# File 'lib/rails/worktrees/project_configuration_loader.rb', line 151 def values @values end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
170 171 172 173 174 |
# File 'lib/rails/worktrees/project_configuration_loader.rb', line 170 def respond_to_missing?(method_name, include_private = false) name = method_name.to_s setter_name?(name) || getter_name?(name) || super end |