class RuboCop::Cop::Performance::OpenStruct


end
end
MyStruct.new(‘my_value1’, ‘my_value2’)
def my_method
MyStruct = Struct.new(:my_key1, :my_key2)
class MyClass
# good
end
end
OpenStruct.new(my_key1: ‘my_value1’, my_key2: ‘my_value2’)
def my_method
class MyClass
# bad
@example
applications with multiple ‘OpenStruct` instantiations.
especially in case of single-threaded
This could have an effect on performance,
definition during program runtime.
Ruby global method cache as it causes dynamic method
Instantiation of an `OpenStruct` invalidates
This cop checks for `OpenStruct.new` calls.

def on_send(node)

def on_send(node)
  open_struct(node) do |method|
    add_offense(node, location: :selector, message: format(MSG, method))
  end
end