Class: RuboCop::Cop::HashTransformMethod::Captures
- Inherits:
-
Struct
- Object
- Struct
- RuboCop::Cop::HashTransformMethod::Captures
- Defined in:
- lib/rubocop/cop/mixin/hash_transform_method.rb
Overview
Internal helper class to hold match data
Instance Method Summary collapse
- #noop_transformation? ⇒ Boolean
- #transformation_uses_both_args? ⇒ Boolean
- #use_transformed_argname? ⇒ Boolean
Instance Method Details
#noop_transformation? ⇒ Boolean
119 120 121 122 |
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 119 def noop_transformation? transforming_body_expr.lvar_type? && transforming_body_expr.children == [transformed_argname] end |
#transformation_uses_both_args? ⇒ Boolean
124 125 126 |
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 124 def transformation_uses_both_args? transforming_body_expr.descendants.include?(unchanged_body_expr) end |
#use_transformed_argname? ⇒ Boolean
128 129 130 131 132 |
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 128 def use_transformed_argname? transforming_body_expr.each_descendant(:lvar).any? do |node| node.source == transformed_argname.to_s end end |