Method: Parser::Source::Range#contains?

Defined in:
lib/parser/source/range.rb

#contains?(other) ⇒ Boolean

Returns true iff this range contains (strictly) ‘other`.

Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?

Parameters:

Returns:

  • (Boolean)
[View source]

262
263
264
# File 'lib/parser/source/range.rb', line 262

def contains?(other)
  (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)
end