class UnrealReaper::Manager
Attributes
installed_packages[R]
obj[R]
Public Class Methods
new(obj)
click to toggle source
# File lib/unreal_reaper/manager.rb, line 7 def initialize(obj) @obj = obj @installed_packages = {} end
Public Instance Methods
_install(name, top_cls, helper_cls, writer_cls, opts = {})
click to toggle source
# File lib/unreal_reaper/manager.rb, line 12 def _install(name, top_cls, helper_cls, writer_cls, opts = {}) options = opts.symbolize_keys installed_packages[name.to_sym] = { top_cls: top_cls, helper_cls: helper_cls, writer_cls: writer_cls } if top_cls top_cls.prepend(PackageObjExt) top_obj = top_cls.new(obj, options) define_singleton_method(name) { top_obj } end if helper_cls helper_cls.prepend(PackageObjExt) _instance_manager_cls.class_eval do define_method name do _packages_objs["#{name}_helper_obj"] ||= helper_cls.new(obj, options) end end end if writer_cls writer_cls.prepend(PackageObjExt) _instance_manager_cls.class_eval do define_method "#{name}=" do |val| (_packages_objs["#{name}_writer_obj"] ||= writer_cls.new(obj, options))._write(val) end end end end
_instance_manager_cls()
click to toggle source
# File lib/unreal_reaper/manager.rb, line 46 def _instance_manager_cls @_instance_manager_cls ||= Class.new { include InstanceManager } end