Sha256: 71d050a1962a4ccfae44bf4323cb38e06d25236bae2e0644d284b1439659e081
Contents?: true
Size: 821 Bytes
Versions: 70
Compression:
Stored size: 821 Bytes
Contents
require_relative "./selector" module Axe module API class Context def initialize @inclusion = [] @exclusion = [] end def within(*selectors) @inclusion.concat selectors.map { |s| Selector::normalize s } end def excluding(*selectors) @exclusion.concat selectors.map { |s| Selector::normalize s } end def to_h to_hash end def to_hash return { exclude: @exclusion } if @inclusion.empty? h = {} h["include"] = @inclusion unless @inclusion.empty? h["exclude"] = @exclusion unless @exclusion.empty? h end def to_json(options = nil) to_hash.to_json options end def empty? to_hash.empty? end alias :to_s :to_json end end end
Version data entries
70 entries across 70 versions & 1 rubygems