/usr/lib/ruby/vendor_ruby/capybara/selector/filter_set.rb is in ruby-capybara 2.10.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # frozen_string_literal: true
require 'capybara/selector/filter'
module Capybara
class Selector
class FilterSet
attr_reader :descriptions
def initialize(name, &block)
@name = name
@descriptions = []
instance_eval(&block)
end
def filter(name, *types_and_options, &block)
options = types_and_options.last.is_a?(Hash) ? types_and_options.pop.dup : {}
types_and_options.each { |k| options[k] = true}
filters[name] = Filter.new(name, block, options)
end
def describe(&block)
descriptions.push block
end
def description(options={})
@descriptions.map {|desc| desc.call(options).to_s }.join
end
def filters
@filters ||= {}
end
class << self
def all
@filter_sets ||= {}
end
def add(name, &block)
all[name.to_sym] = FilterSet.new(name.to_sym, &block)
end
def remove(name)
all.delete(name.to_sym)
end
end
end
end
end
|