Class: PryCoolline::ParenMatch::AST::DanglingClose

Inherits:
Struct
  • Object
show all
Defined in:
lib/pry-coolline/paren_match.rb

Overview

A top-level closing paren — meaning there's no matching opening character.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tokObject

Returns the value of attribute tok

Returns:

  • (Object)

    the current value of tok



120
121
122
# File 'lib/pry-coolline/paren_match.rb', line 120

def tok
  @tok
end

Instance Method Details

#pair_at(pos) ⇒ Pair

Finds the opening and closing tokens that should be matched at a certain position in the string.

It is assumed you can be looking for the closing parenthesis when on the opening one, or for the opening one when selecting the character that immediately follows it.

Parameters:

  • pos (Integer)

Returns:

  • (Pair)

    An (open, close) pair. Notice both the opening and closing tokens coud be nil.



122
123
124
125
126
# File 'lib/pry-coolline/paren_match.rb', line 122

def pair_at(pos)
  if pos == tok.pos + tok.str.size
    Pair.new(nil, tok)
  end
end