module VirtDisk::ExportMethods

Utility module used by VirtDisk plug-ins, allowing them to export methods upstream.

Typically, VirtDisk plug-ins are linked in a chain - each plug-in communicating with the plug-in immediately upstream from it (where upstream is closer to the source of the data). The last downstream plug-in (the volume head) is the object accessed directly by the client.

This module enables upstream plug-ins to export methods, so they can be called directly from the volume head.

@note Every plug-in class must include this module, even if they don't export any methods.

Public Class Methods

included(host_class) click to toggle source
# File lib/virt_disk/export_methods.rb, line 40
def self.included(host_class)
  host_class.extend(ClassMethods)
end

Public Instance Methods

delegate() click to toggle source

The module immediately upstream from this one.

@return [Object] the module immediately upstream from this one.

# File lib/virt_disk/export_methods.rb, line 54
def delegate
  @__delegate
end
delegate=(obj) click to toggle source

Set the module immediately upstream from this one.

@param obj [Object] the upstream module.

# File lib/virt_disk/export_methods.rb, line 47
def delegate=(obj)
  @__delegate = obj
end
exported?(sym) click to toggle source

@param sym [Symbol] @return [Boolean] - true if sym is exported by this module's class, false otherwise.

# File lib/virt_disk/export_methods.rb, line 60
def exported?(sym)
  self.class.exported?(sym)
end
method_missing(sym, *args) click to toggle source
Calls superclass method
# File lib/virt_disk/export_methods.rb, line 69
def method_missing(sym, *args)
  super unless respond_to_missing?(sym)
  @__delegate.send(sym, *args)
end
respond_to_missing?(sym, include_all = false) click to toggle source
# File lib/virt_disk/export_methods.rb, line 64
def respond_to_missing?(sym, include_all = false)
  return false unless @__delegate
  @__delegate.exported?(sym) || @__delegate.send(:respond_to_missing?, sym, include_all)
end