123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/rubocop/cop/mixin/hash_transform_method.rb

Overview

Internal helper class to hold match data

Instance Attribute Summary

Instance Attribute Details

#noop_transformation?Boolean (readonly)

[ GitHub ]

  
# 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 (readonly)

[ GitHub ]

  
# 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

#transformed_argname (rw, private)

Internal helper class to hold match data

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 118

Captures = Struct.new(:transformed_argname, :transforming_body_expr, :unchanged_body_expr)

#transforming_body_expr (rw, private)

Internal helper class to hold match data

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 118

Captures = Struct.new(:transformed_argname, :transforming_body_expr, :unchanged_body_expr)

#unchanged_body_expr (rw, private)

Internal helper class to hold match data

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 118

Captures = Struct.new(:transformed_argname, :transforming_body_expr, :unchanged_body_expr)

#use_transformed_argname?Boolean (readonly)

[ GitHub ]

  
# 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