class Menu::Linkage

Public Class Methods

new(optsize) click to toggle source

this private class contains functions for binding functions to an optid

# File lib/artsy/menu.rb, line 56
def initialize(optsize)
  # initializing the object, setting up the callbackMethods instance array based on optsize
  @callbackMethods = Array.new(optsize)
end

Public Instance Methods

bindMethod(toOpt, mname) click to toggle source
# File lib/artsy/menu.rb, line 61
def bindMethod(toOpt, mname)
  # binding methods to a value in an array, to be called back later
  @callbackMethods[toOpt] = mname
end
run(target, *args) click to toggle source
# File lib/artsy/menu.rb, line 66
def run(target, *args)
  # run the method assigned to the integer value in the array
  @callbackMethods[target].call(*args) # taking any arguments, as they are sent to the attached method
end