class Ruby::Prism::StringQuery

Query methods that allow categorizing strings based on their context for where they could be valid in a Ruby syntax tree.

Attributes

The string that this query is wrapping.

Public Class Methods

Initialize a new query with the given string.

: (String string) -> void

# File lib/ruby/prism/string_query.rb, line 21
def initialize(string)
  @string = string
end

Public Instance Methods

Whether or not this string is a valid constant name.

: () -> bool

# File lib/ruby/prism/string_query.rb, line 35
def constant?
  StringQuery.constant?(string)
end

Whether or not this string is a valid local variable name.

: () -> bool

# File lib/ruby/prism/string_query.rb, line 28
def local?
  StringQuery.local?(string)
end

Whether or not this string is a valid method name.

: () -> bool

# File lib/ruby/prism/string_query.rb, line 42
def method_name?
  StringQuery.method_name?(string)
end