Class: Spoom::Deadcode::Send
- Inherits:
-
T::Struct
- Object
- T::Struct
- Spoom::Deadcode::Send
- Defined in:
- lib/spoom/deadcode/send.rb
Overview
An abstraction to simplify handling of Prism::CallNode nodes.
Instance Method Summary collapse
-
#each_arg(arg_type, &block) ⇒ Object
: [T] (Class arg_type) { (T arg) -> void } -> void.
-
#each_arg_assoc(&block) ⇒ Object
: { (Prism::Node key, Prism::Node? value) -> void } -> void.
Instance Method Details
#each_arg(arg_type, &block) ⇒ Object
: [T] (Class arg_type) { (T arg) -> void } -> void
16 17 18 19 20 |
# File 'lib/spoom/deadcode/send.rb', line 16 def each_arg(arg_type, &block) args.each do |arg| yield(T.unsafe(arg)) if arg.is_a?(arg_type) end end |
#each_arg_assoc(&block) ⇒ Object
: { (Prism::Node key, Prism::Node? value) -> void } -> void
23 24 25 26 27 28 29 30 31 |
# File 'lib/spoom/deadcode/send.rb', line 23 def each_arg_assoc(&block) args.each do |arg| next unless arg.is_a?(Prism::KeywordHashNode) || arg.is_a?(Prism::HashNode) arg.elements.each do |assoc| yield(assoc.key, assoc.value) if assoc.is_a?(Prism::AssocNode) end end end |