Class: CSS::Selectors::AnB

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

Overview

‘An+B` integer pair. `step` is the `n` coefficient, `offset` is the constant term. `even` => AnB(2, 0), `odd` => AnB(2, 1), `5` => AnB(0, 5), `n` => AnB(1, 0). `of` is the optional `of S` filter (a `SelectorList`), `nil` except on `:nth-child` / `:nth-last-child`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step:, offset:, of: nil) ⇒ AnB

Returns a new instance of AnB.



77
78
79
# File 'lib/css/selectors/nodes.rb', line 77

def initialize(step:, offset:, of: nil)
  super
end

Instance Attribute Details

#ofObject (readonly)

Returns the value of attribute of

Returns:

  • (Object)

    the current value of of



74
75
76
# File 'lib/css/selectors/nodes.rb', line 74

def of
  @of
end

#offsetObject (readonly)

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



74
75
76
# File 'lib/css/selectors/nodes.rb', line 74

def offset
  @offset
end

#stepObject (readonly)

Returns the value of attribute step

Returns:

  • (Object)

    the current value of step



74
75
76
# File 'lib/css/selectors/nodes.rb', line 74

def step
  @step
end

Instance Method Details

#to_sObject



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

def to_s = Selectors::Serializer.serialize(self)