Class: ConvenientService::Utils::Object::InstanceVariableDelete

Inherits:
Support::Command
  • Object
show all
Defined in:
lib/convenient_service/utils/object/instance_variable_delete.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(object, ivar_name) ⇒ void

Parameters:

  • object (Object)
  • ivar_name (Symbol)


32
33
34
35
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 32

def initialize(object, ivar_name)
  @object = object
  @ivar_name = ivar_name
end

Instance Attribute Details

#ivar_nameObject (readonly)

Returns the value of attribute ivar_name.



25
26
27
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 25

def ivar_name
  @ivar_name
end

#objectObject (readonly)

Returns the value of attribute object.



19
20
21
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 19

def object
  @object
end

Instance Method Details

#callObject

Returns Value of ivar. Can be any type.

Returns:

  • (Object)

    Value of ivar. Can be any type.



40
41
42
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 40

def call
  object.remove_instance_variable(ivar_name) if object.instance_variable_defined?(ivar_name)
end