Class: RSpec::Mocks::ConstantMutator::BaseMutator
- Includes:
- Support::RecursiveConstMethods
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/mutate_const.rb
Overview
Contains common functionality used by all of the constant mutators.
Direct Known Subclasses
ConstantHider, DefinedConstantReplacer, UndefinedConstantSetter
Instance Attribute Summary collapse
-
#full_constant_name ⇒ Object
readonly
Returns the value of attribute full_constant_name.
-
#original_value ⇒ Object
readonly
Returns the value of attribute original_value.
Instance Method Summary collapse
- #idempotently_reset ⇒ Object
-
#initialize(full_constant_name, mutated_value, transfer_nested_constants) ⇒ BaseMutator
constructor
A new instance of BaseMutator.
- #to_constant ⇒ Object
Methods included from Support::RecursiveConstMethods
#const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get
Constructor Details
#initialize(full_constant_name, mutated_value, transfer_nested_constants) ⇒ BaseMutator
Returns a new instance of BaseMutator.
144 145 146 147 148 149 150 151 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/mutate_const.rb', line 144 def initialize(full_constant_name, mutated_value, transfer_nested_constants) @full_constant_name = normalize_const_name(full_constant_name) @mutated_value = mutated_value @transfer_nested_constants = transfer_nested_constants @context_parts = @full_constant_name.split('::') @const_name = @context_parts.pop @reset_performed = false end |
Instance Attribute Details
#full_constant_name ⇒ Object (readonly)
Returns the value of attribute full_constant_name.
142 143 144 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/mutate_const.rb', line 142 def full_constant_name @full_constant_name end |
#original_value ⇒ Object (readonly)
Returns the value of attribute original_value.
142 143 144 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/mutate_const.rb', line 142 def original_value @original_value end |
Instance Method Details
#idempotently_reset ⇒ Object
160 161 162 163 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/mutate_const.rb', line 160 def idempotently_reset reset unless @reset_performed @reset_performed = true end |