Method: Sequence#position?

Defined in:
lib/sequence.rb

#position?(p) ⇒ Boolean

this queries whether a particular #position p is valid (is a child or self).

numeric positions and also be tested

Returns:

  • (Boolean)


404
405
406
407
408
409
410
# File 'lib/sequence.rb', line 404

def position?(p)
  case p
  when Integer; (-size..size)===p
  when Position; equal? p.data
  else equal? p
  end
end