Method: Pakyow::Support::ObjectMaker.define_const_for_object_with_name

Defined in:
lib/pakyow/support/makeable/object_maker.rb

.define_const_for_object_with_name(object_to_define, object_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
12
13
14
15
16
17
# File 'lib/pakyow/support/makeable/object_maker.rb', line 9

def self.define_const_for_object_with_name(object_to_define, object_name)
  return if object_name.nil?

  target = object_name.namespace.parts.inject(Object) { |target_for_part, object_name_part|
    ObjectMaker.define_object_on_target_with_constant_name(Module.new, target_for_part, object_name_part)
  }

  ObjectMaker.define_object_on_target_with_constant_name(object_to_define, target, object_name.name)
end