summaryrefslogtreecommitdiff
path: root/lib/prism/string_query.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prism/string_query.rb')
-rw-r--r--lib/prism/string_query.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/prism/string_query.rb b/lib/prism/string_query.rb
index 9011051d2b..99ce57e5fe 100644
--- a/lib/prism/string_query.rb
+++ b/lib/prism/string_query.rb
@@ -1,28 +1,44 @@
# frozen_string_literal: true
+# :markup: markdown
+#--
+# rbs_inline: enabled
module Prism
# Query methods that allow categorizing strings based on their context for
# where they could be valid in a Ruby syntax tree.
class StringQuery
+ # @rbs!
+ # def self.local?: (String string) -> bool
+ # def self.constant?: (String string) -> bool
+ # def self.method_name?: (String string) -> bool
+
# The string that this query is wrapping.
- attr_reader :string
+ attr_reader :string #: String
# Initialize a new query with the given string.
+ #--
+ #: (String string) -> void
def initialize(string)
@string = string
end
# Whether or not this string is a valid local variable name.
+ #--
+ #: () -> bool
def local?
StringQuery.local?(string)
end
# Whether or not this string is a valid constant name.
+ #--
+ #: () -> bool
def constant?
StringQuery.constant?(string)
end
# Whether or not this string is a valid method name.
+ #--
+ #: () -> bool
def method_name?
StringQuery.method_name?(string)
end