Class: Object

Inherits:
BasicObject
Defined in:
lib/rggen/core/core_extensions/object.rb

Instance Method Summary collapse

Instance Method Details

#export_instance_variable(variable, to) ⇒ Object



4
5
6
7
8
9
# File 'lib/rggen/core/core_extensions/object.rb', line 4

def export_instance_variable(variable, to)
  instance_variable_defined?(variable) &&
    instance_variable_get(variable)
      .then { |v| block_given? ? yield(v) : v }
      .then { |v| to.instance_variable_set(variable, v) }
end

#singleton_execObject



11
12
13
# File 'lib/rggen/core/core_extensions/object.rb', line 11

def singleton_exec(...)
  singleton_class.class_exec(...)
end