Sha256: a1363a3319c9884cd267ed6914433c84b2f0838f4ada5ae9969023dede5d5950

Contents?: true

Size: 856 Bytes

Versions: 3

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

##
#
#
module ConvenientService
  module Utils
    module Object
      class InstanceVariableDelete < Support::Command
        ##
        # @!attribute [r] object
        #   @return [Object]
        #
        attr_reader :object

        ##
        # @!attribute [r] ivar_name
        #   @return [Symbol, String]
        #
        attr_reader :ivar_name

        ##
        # @param object [Object]
        # @param ivar_name [Symbol]
        # @return [void]
        #
        def initialize(object, ivar_name)
          @object = object
          @ivar_name = ivar_name
        end

        ##
        # @return [Object] Value of ivar. Can be any type.
        #
        def call
          object.remove_instance_variable(ivar_name) if object.instance_variable_defined?(ivar_name)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/utils/object/instance_variable_delete.rb
convenient_service-0.19.0 lib/convenient_service/utils/object/instance_variable_delete.rb
convenient_service-0.18.0 lib/convenient_service/utils/object/instance_variable_delete.rb