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)

129
130
131
132
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 129

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

#transformation_uses_both_args?Boolean

Returns:

  • (Boolean)

134
135
136
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 134

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