Sha256: f0db6d33224da7401c3df19bf352d20e3d6cee3a1c32595aa04e58ba34795a4d

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

module WatirSpec
  class Implementation

    attr_writer :name, :guard_proc, :browser_class
    attr_accessor :browser_args

    def initialize
      @guard_proc = nil
    end

    def browser_class
      @browser_class || raise("browser_class not set")
    end

    def name
      @name || raise("implementation name not set")
    end

    def matches_guard?(args)
      return @guard_proc.call(args) if @guard_proc

      args.include? name
    end

    def matching_guards_in(guards)
      result = []
      guards.each { |args, data| data.each { |d| result << d } if matches_guard?(args) }

      result
    end

  end # Implementation
end # WatirSpec

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-6.0.2 lib/watirspec/implementation.rb
watir-6.0.1 lib/watirspec/implementation.rb
watir-6.0.0 lib/watirspec/implementation.rb