[ruby/prism] Add Node::type
https://github.com/ruby/prism/commit/ca4943e3f9
This commit is contained in:
parent
94cb5765e2
commit
f413e50ec2
@ -211,6 +211,16 @@ module Prism
|
|||||||
def type
|
def type
|
||||||
:<%= node.human %>
|
:<%= node.human %>
|
||||||
end
|
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
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
<%- flags.each_with_index do |flag, flag_index| -%>
|
<%- flags.each_with_index do |flag, flag_index| -%>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user