123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Core::FilterRules Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
RSpec::Core::InclusionRules
Inherits: Object
Defined in: rspec-core/lib/rspec/core/filter_manager.rb

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Class Method Details

.build

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 122

def self.build
  exclusions = ExclusionRules.new
  inclusions = InclusionRules.new
  exclusions.opposite = inclusions
  inclusions.opposite = exclusions
  [exclusions, inclusions]
end

Instance Attribute Details

#empty?Boolean (readonly)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 165

def empty?
  rules.empty?
end

#opposite (rw)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 119

attr_accessor :opposite

#rules (readonly)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 120

attr_reader :rules

Instance Method Details

#[](key)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 161

def [](key)
  @rules[key]
end

#add(updated)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 134

def add(updated)
  @rules.merge!(updated).each_key { |k| opposite.delete(k) }
end

#add_with_low_priority(updated)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 138

def add_with_low_priority(updated)
  updated = updated.merge(@rules)
  opposite.each_pair { |k, v| updated.delete(k) if updated[k] == v }
  @rules.replace(updated)
end

#clear

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 149

def clear
  @rules.clear
end

#delete(key)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 153

def delete(key)
  @rules.delete(key)
end

#description

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 173

def description
  rules.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)', '')
end

#each_pair(&block)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 169

def each_pair(&block)
  @rules.each_pair(&block)
end

#fetch(*args, &block)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 157

def fetch(*args, &block)
  @rules.fetch(*args, &block)
end

#include_example?(example) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 177

def include_example?(example)
  MetadataFilter.apply?(:any?, @rules, example.)
end

#use_only(updated)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/filter_manager.rb', line 144

def use_only(updated)
  updated.each_key { |k| opposite.delete(k) }
  @rules.replace(updated)
end