Sha256: 3d11057c397fd4d3878e61d39e3603c5a216925d5686b31d88156f0bbfdc46ef
Contents?: true
Size: 821 Bytes
Versions: 51
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| Array(Selector.new s) } end def excluding(*selectors) @exclusion.concat selectors.map { |s| Array(Selector.new 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
51 entries across 51 versions & 1 rubygems