Module: RuboCop::Cop::Sorbet::TEnum
- Extended by:
- NodePattern::Macros
- Included in:
- ForbidComparableTEnum, MultipleTEnumValues
- Defined in:
- lib/rubocop/cop/sorbet/mixin/t_enum.rb
Overview
Mixing for writing cops that deal with ‘T::Enum`s
Instance Method Summary collapse
Instance Method Details
#after_class(node) ⇒ Object
23 24 25 |
# File 'lib/rubocop/cop/sorbet/mixin/t_enum.rb', line 23 def after_class(node) @scopes.pop end |
#initialize ⇒ Object
9 10 11 12 |
# File 'lib/rubocop/cop/sorbet/mixin/t_enum.rb', line 9 def initialize(*) @scopes = [] super end |
#on_class(node) ⇒ Object
19 20 21 |
# File 'lib/rubocop/cop/sorbet/mixin/t_enum.rb', line 19 def on_class(node) @scopes.push(node) end |
#t_enum?(node) ⇒ Object
15 16 17 |
# File 'lib/rubocop/cop/sorbet/mixin/t_enum.rb', line 15 def_node_matcher :t_enum?, <<~PATTERN (class (const...) (const (const nil? :T) :Enum) ...) PATTERN |