Sha256: 2f5b9eecb8438c06cd09f4be17c6220bc46747bcaa45c71627df5e54364eddf4

Contents?: true

Size: 555 Bytes

Versions: 67

Compression:

Stored size: 555 Bytes

Contents

class Module
  def focus *wanteds
    wanteds.map! { |m| m.to_s }
    unwanteds = public_instance_methods(false).grep(/test_/).map(&:to_s)
    unwanteds -= wanteds
    unwanteds.each do |unwanted|
      remove_method unwanted
    end
  end

  def focus_re regexp
    focus(*public_instance_methods.grep(regexp))
  end

  def blur
    parent = self.superclass

    ObjectSpace.each_object Class do |klass|
      next unless parent > klass
      next if klass == self

      klass.send :focus
      klass.send :undef_method, :default_test
    end
  end
end

Version data entries

67 entries across 67 versions & 5 rubygems

Version Path
cloudsmith-api-1.61.3 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.1/lib/focus.rb
cloudsmith-api-1.42.3 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.1/lib/focus.rb
cloudsmith-api-1.33.7 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.1/lib/focus.rb
cloudsmith-api-1.30.0 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.1/lib/focus.rb
ZenTest-4.12.1 lib/focus.rb
cloudsmith-api-0.57.1 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.53.79 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.53.17 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/ZenTest-4.12.0/lib/focus.rb