class Prism::StringQuery
that it can maintain a consistent interface
Here we are going to patch StringQuery to put in the class-level methods so
def constant?(string)
def constant?(string) query(LibRubyParser.pm_string_query_constant(string, string.bytesize, string.encoding.name)) end
def constant?
def constant? StringQuery.constant?(string) end
def initialize(string)
def initialize(string) @string = string end
def local?(string)
def local?(string) query(LibRubyParser.pm_string_query_local(string, string.bytesize, string.encoding.name)) end
def local?
def local? StringQuery.local?(string) end
def method_name?(string)
def method_name?(string) query(LibRubyParser.pm_string_query_method_name(string, string.bytesize, string.encoding.name)) end
def method_name?
def method_name? StringQuery.method_name?(string) end
def query(result)
def query(result) case result when :PM_STRING_QUERY_ERROR raise ArgumentError, "Invalid or non ascii-compatible encoding" when :PM_STRING_QUERY_FALSE false when :PM_STRING_QUERY_TRUE true end end