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)


27
28
29
30
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 27

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.



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

def ivar_name
  @ivar_name
end

#objectObject (readonly)

Returns the value of attribute object.



14
15
16
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 14

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.



35
36
37
# File 'lib/convenient_service/utils/object/instance_variable_delete.rb', line 35

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