Class: RuboCop::Cop::HashTransformMethod::Captures

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubocop/cop/mixin/hash_transform_method.rb

Overview

Internal helper class to hold match data

Instance Method Summary collapse

Instance Method Details

#noop_transformation?Boolean

Returns:

  • (Boolean)

121
122
123
124
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 121

def noop_transformation?
  transforming_body_expr.lvar_type? &&
    transforming_body_expr.children == [transformed_argname]
end

#transformation_uses_both_args?Boolean

Returns:

  • (Boolean)

126
127
128
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 126

def transformation_uses_both_args?
  transforming_body_expr.descendants.include?(unchanged_body_expr)
end