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)


114
115
116
117
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 114

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

#transformation_uses_both_args?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 119

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