class RSpec::Core::FilterRules

@private

Constants

PROC_HEX_NUMBER
PROJECT_DIR

Attributes

opposite[RW]
rules[R]

Public Class Methods

build() click to toggle source
# File lib/rspec/core/filter_manager.rb, line 143
def self.build
  exclusions = ExclusionRules.new
  inclusions = InclusionRules.new
  exclusions.opposite = inclusions
  inclusions.opposite = exclusions
  [exclusions, inclusions]
end
new(*args, &block) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 151
def initialize(*args, &block)
  @rules = Hash.new(*args, &block)
end

Public Instance Methods

[](key) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 182
def [](key)
  @rules[key]
end
add(updated) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 155
def add(updated)
  @rules.merge!(updated).each_key { |k| opposite.delete(k) }
end
add_with_low_priority(_updated) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 159
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() click to toggle source
# File lib/rspec/core/filter_manager.rb, line 170
def clear
  @rules.clear
end
delete(key) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 174
def delete(key)
  @rules.delete(key)
end
description() click to toggle source
# File lib/rspec/core/filter_manager.rb, line 194
def description
  rules.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','')
end
each_pair(&block) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 190
def each_pair(&block)
  @rules.each_pair(&block)
end
empty?() click to toggle source
# File lib/rspec/core/filter_manager.rb, line 186
def empty?
  rules.empty?
end
fetch(*args, &block) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 178
def fetch(*args, &block)
  @rules.fetch(*args, &block)
end
use_only(updated) click to toggle source
# File lib/rspec/core/filter_manager.rb, line 165
def use_only(updated)
  updated.each_key { |k| opposite.delete(k) }
  @rules.replace(updated)
end