class RuboCop::AST::PairNode

to all ‘pair` nodes within RuboCop.
node when the builder constructs the AST, making its methods available
A node extension for `pair` nodes. This will be used in place of a plain

def colon?

Returns:
  • (Boolean) - whether this `pair` uses a colon delimiter
def colon?
  loc.operator.is?(COLON)
end

def delimiter(with_spacing = false)

Returns:
  • (String) - the delimiter of the `pair`

Parameters:
  • with_spacing (Boolean) -- whether to include spacing
def delimiter(with_spacing = false)
  if with_spacing
    hash_rocket? ? SPACED_HASH_ROCKET : SPACED_COLON
  else
    hash_rocket? ? HASH_ROCKET : COLON
  end
end

def hash_rocket?

Returns:
  • (Boolean) - whether this `pair` uses a hash rocket delimiter
def hash_rocket?
  loc.operator.is?(HASH_ROCKET)
end

def inverse_delimiter(with_spacing = false)

Returns:
  • (String) - the inverse delimiter of the `pair`

Parameters:
  • with_spacing (Boolean) -- whether to include spacing
def inverse_delimiter(with_spacing = false)
  if with_spacing
    hash_rocket? ? SPACED_COLON : SPACED_HASH_ROCKET
  else
    hash_rocket? ? COLON : HASH_ROCKET
  end
end

def node_parts

Returns:
  • (Array) - the different parts of the `pair`
def node_parts
  to_a
end