[ruby/prism] Add Node::type

https://github.com/ruby/prism/commit/ca4943e3f9
This commit is contained in:
Kevin Newton 2023-10-11 11:02:58 -04:00 committed by git
parent 94cb5765e2
commit f413e50ec2

View File

@ -211,6 +211,16 @@ module Prism
def type
:<%= node.human %>
end
# Similar to #type, this method returns a symbol that you can use for
# splitting on the type of the node without having to do a long === chain.
# Note that like #type, it will still be slower than using == for a single
# class, but should be faster in a case statement or an array comparison.
#
# def self.type: () -> Symbol
def self.type
:<%= node.human %>
end
end
<%- end -%>
<%- flags.each_with_index do |flag, flag_index| -%>