# frozen_string_literal: true module UnrealReaper class Installer attr_reader :cls def initialize(cls) @cls = cls end def install(package_name, opts = {}) package = UnrealReaper.packages[package_name.to_sym] raise "Not found package '#{package_name}'" unless package opts = opts.symbolize_keys init_entry cls.ur._install(package_name, *package.values_at(:top_cls, :helper_cls, :writer_cls), opts) end def init_entry return if cls.methods.include?(:ur) cls.class_eval do def self.ur @ur_manager ||= Manager.new(self) end def ur @ur_manager ||= begin self.class.ur._instance_manager_cls.new(self) end end def ur=(data) ur._write(data) end end end end end