module VirtDisk::ExportMethods::ClassMethods

Public Instance Methods

export(*syms) click to toggle source

Export one or more methods, making them callable from the volume head.

@param syms [Symbol] the names of one or more methods to be exported. @raise [RuntimeError] if any of the methods aren't defined in the class.

# File lib/virt_disk/export_methods.rb, line 18
def export(*syms)
  syms.each do |s|
    sym = s.to_sym
    raise "Method not defined in class: #{sym}" unless method_defined?(sym)
    return nil if exports.include?(sym)
    exports << sym
  end
  nil
end
exported?(sym) click to toggle source

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

# File lib/virt_disk/export_methods.rb, line 35
def exported?(sym)
  exports.include?(sym.to_sym)
end
exports() click to toggle source

@return [Array<Symbol>] array of exported methods.

# File lib/virt_disk/export_methods.rb, line 29
def exports
  @__exported_methods ||= []
end