Module: OverrideKernel
- Defined in:
- lib/override_kernel/override_kernel.rb
Overview
–
Copyright (C) 2011 Travis Herrick #
#
\v^V,^!v\^/ #
~% %~ #
{ _ _ } #
( * - ) #
| / | #
\ _, / #
\__.__/ #
#
This program is free software: you can redistribute it # and/or modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, # either version 3 of the License, or (at your option) any later version. #
#
Commercial licensing may be available for a fee under a different license. #
This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. #
#
You should have received a copy of the GNU General Public License # along with this program. If not, see <www.gnu.org/licenses/>. #
++
Constant Summary collapse
- AppState =
This constant is used to indicate whether the application would have been halted by Kernel functions.
StateManager.new(:alive, [:alive, :dead])
Class Method Summary collapse
- .method_missing(method, *args, &block) ⇒ Object
- .respond_to_missing?(method, include_private) ⇒ Boolean
Class Method Details
.method_missing(method, *args, &block) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# 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) ⇒ Boolean
59 60 61 62 63 64 65 |
# 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 |