Class: RSpec::Core::Ordering::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb

Overview

Stores the different ordering strategies.

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Registry

Returns a new instance of Registry.



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 84

def initialize(configuration)
  @configuration = configuration
  @strategies    = {}

  register(:random, Random.new(configuration))
  register(:recently_modified, RecentlyModified.new)

  identity = Identity.new
  register(:defined, identity)

  # The default global ordering is --defined.
  register(:global, identity)
end

Instance Method Details

#fetch(name, &fallback) ⇒ Object



98
99
100
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 98

def fetch(name, &fallback)
  @strategies.fetch(name, &fallback)
end

#register(sym, strategy) ⇒ Object



102
103
104
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 102

def register(sym, strategy)
  @strategies[sym] = strategy
end

#used_random_seed?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 106

def used_random_seed?
  @strategies[:random].used?
end