Sha256: 7d887b3ed0d9c513a28a5ac55b94d30abf51c52339e63e4bf7e4f1a72925f890

Contents?: true

Size: 731 Bytes

Versions: 14

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true
module Capybara
  class Selector
    module Filters
      class Base
        def initialize(name, block, options={})
          @name = name
          @block = block
          @options = options
          @options[:valid_values] = [true,false] if options[:boolean]
        end

        def default?
          @options.has_key?(:default)
        end

        def default
          @options[:default]
        end

        def skip?(value)
          @options.has_key?(:skip_if) && value == @options[:skip_if]
        end

        private

        def valid_value?(value)
          !@options.has_key?(:valid_values) || Array(@options[:valid_values]).include?(value)
        end
      end
    end
  end
end

Version data entries

14 entries across 12 versions & 2 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/capybara-2.18.0/lib/capybara/selector/filters/base.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/capybara-2.16.1/lib/capybara/selector/filters/base.rb
tdiary-5.0.8 vendor/bundle/gems/capybara-2.18.0/lib/capybara/selector/filters/base.rb
capybara-2.18.0 lib/capybara/selector/filters/base.rb
capybara-2.17.0 lib/capybara/selector/filters/base.rb
tdiary-5.0.7 vendor/bundle/gems/capybara-2.16.1/lib/capybara/selector/filters/base.rb
capybara-2.16.1 lib/capybara/selector/filters/base.rb
capybara-2.16.0 lib/capybara/selector/filters/base.rb
capybara-2.15.4 lib/capybara/selector/filters/base.rb
capybara-2.15.3 lib/capybara/selector/filters/base.rb
capybara-2.15.2 lib/capybara/selector/filters/base.rb
tdiary-5.0.6 vendor/bundle/gems/capybara-2.15.1/lib/capybara/selector/filters/base.rb
capybara-2.15.1 lib/capybara/selector/filters/base.rb
capybara-2.15.0 lib/capybara/selector/filters/base.rb