class Axe::API::Context
Public Class Methods
new()
click to toggle source
# File lib/axe/api/context.rb, line 6 def initialize @inclusion = [] @exclusion = [] end
Public Instance Methods
empty?()
click to toggle source
# File lib/axe/api/context.rb, line 28 def empty? to_hash.empty? end
excluding(*selectors)
click to toggle source
# File lib/axe/api/context.rb, line 15 def excluding(*selectors) @exclusion.concat selectors.map { |s| Array(Selector.new s) } end
to_hash()
click to toggle source
# File lib/axe/api/context.rb, line 19 def to_hash { include: @inclusion, exclude: @exclusion } .reject { |k, v| v.empty? } end
to_json()
click to toggle source
# File lib/axe/api/context.rb, line 24 def to_json to_hash.to_json end
Also aliased as: to_s
within(*selectors)
click to toggle source
# File lib/axe/api/context.rb, line 11 def within(*selectors) @inclusion.concat selectors.map { |s| Array(Selector.new s) } end