Class: CSS::Selectors::AttributeSelector

Inherits:
Data
  • Object
show all
Includes:
Node
Defined in:
lib/css/selectors/nodes.rb

Overview

Attribute matchers:

nil         — `[name]` (presence)
:exact      — `[a=b]`
:includes   — `[a~=b]`
:dash       — `[a|=b]`
:prefix     — `[a^=b]`
:suffix     — `[a$=b]`
:substring  — `[a*=b]`

‘case_flag` is `nil`, `:i`, or `:s`. `namespace` is the attribute namespace constraint (`nil` = no prefix, `’*‘` = any, `”` = no namespace); a declared prefix is rejected. Attribute namespaces aren’t tracked at match time (HTML attributes are all in no namespace), so matching is by local name.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, matcher:, value:, case_flag:, namespace: nil) ⇒ AttributeSelector

Returns a new instance of AttributeSelector.



61
# File 'lib/css/selectors/nodes.rb', line 61

def initialize(name:, matcher:, value:, case_flag:, namespace: nil) = super

Instance Attribute Details

#case_flagObject (readonly)

Returns the value of attribute case_flag

Returns:

  • (Object)

    the current value of case_flag



59
60
61
# File 'lib/css/selectors/nodes.rb', line 59

def case_flag
  @case_flag
end

#matcherObject (readonly)

Returns the value of attribute matcher

Returns:

  • (Object)

    the current value of matcher



59
60
61
# File 'lib/css/selectors/nodes.rb', line 59

def matcher
  @matcher
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



59
60
61
# File 'lib/css/selectors/nodes.rb', line 59

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace

Returns:

  • (Object)

    the current value of namespace



59
60
61
# File 'lib/css/selectors/nodes.rb', line 59

def namespace
  @namespace
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



59
60
61
# File 'lib/css/selectors/nodes.rb', line 59

def value
  @value
end