module OverrideKernel

Constants

AppState

This constant is used to indicate whether the application would have been halted by Kernel functions.

Public Class Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/override_kernel/override_kernel.rb, line 42
def self.method_missing(method, *args, &block)
  if method_list.include?(method.to_s.sub(/^(start|stop)_/, '').to_sym)
    var = '@' + method.to_s.sub(/^(start|stop)_/, '')
    case method.to_s
      when /^start/
        send :instance_variable_set, var.to_sym, true
      when /^stop/
        send :instance_variable_set, var.to_sym, false
      when var[1..-1]
        return nil unless instance_variables.include?(var.to_sym)
        send :instance_variable_get, var.to_sym
    end
  else
    super
  end
end
respond_to_missing?(method, include_private) click to toggle source
Calls superclass method
# File lib/override_kernel/override_kernel.rb, line 59
def self.respond_to_missing?(method, include_private)
  if method_list.include?(method.to_s.sub(/^(start|stop)_/, '').to_sym)
    return true
  else
    super
  end
end

Private Class Methods

method_list() click to toggle source

Returns a list of methods that will be dynamically handled by the module. The following methods will be created:

:start_#{method_name} #=> @method_name = true
:stop_#{method_name}  #=> @method_name = false
:#{method_name}       #=> Returns the value of @method_name

Output

Array

An array of base method names.

# File lib/override_kernel/override_kernel.rb, line 77
def method_list
  [
    :override_exit,
  ]
end