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
(String string) → void
Source
# File lib/ruby/prism/string_query.rb, line 21 def initialize(string) @string = string end
Initialize a new query with the given string.
Public Instance Methods
() → bool
Source
# File lib/ruby/prism/string_query.rb, line 35 def constant? StringQuery.constant?(string) end
Whether or not this string is a valid constant name.
() → bool
Source
# File lib/ruby/prism/string_query.rb, line 28 def local? StringQuery.local?(string) end
Whether or not this string is a valid local variable name.
() → bool
Source
# File lib/ruby/prism/string_query.rb, line 42 def method_name? StringQuery.method_name?(string) end
Whether or not this string is a valid method name.