Module: RSpec::Core::HashImitatable
- Included in:
- Example::ExecutionResult, LegacyExampleGroupHash
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata.rb
Overview
Mixin that makes the including class imitate a hash for backwards compatibility. The including class should use ‘attr_accessor` to declare attributes.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
350 351 352 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata.rb', line 350 def self.included(klass) klass.extend ClassMethods end |
Instance Method Details
#[](key) ⇒ Object
388 389 390 391 392 393 394 395 396 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata.rb', line 388 def [](key) issue_deprecation(:[], key) if directly_supports_attribute?(key) get_value(key) else extra_hash_attributes[key] end end |
#[]=(key, value) ⇒ Object
398 399 400 401 402 403 404 405 406 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata.rb', line 398 def []=(key, value) issue_deprecation(:[]=, key, value) if directly_supports_attribute?(key) set_value(key, value) else extra_hash_attributes[key] = value end end |
#to_h ⇒ Object
354 355 356 357 358 359 360 361 362 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata.rb', line 354 def to_h hash = extra_hash_attributes.dup self.class.hash_attribute_names.each do |name| hash[name] = __send__(name) end hash end |