module Rubikon::Application::ClassMethods
This module contains all class methods of Application::Base
and its subclasses.
@author Sebastian Staudt @see Application::Base
@since 0.2.0
Private Instance Methods
autorun?()
click to toggle source
Returns whether this application should be run automatically
# File lib/rubikon/application/class_methods.rb, line 23 def autorun? instance.instance_variable_get(:@settings)[:autorun] || false end
inherited(subclass)
click to toggle source
Enables autorun functionality using Kernel#at_exit
This is called automatically when subclassing Application::Base.
@param [Class] subclass The subclass inheriting from Application::Base
.
This is the user's application.
# File lib/rubikon/application/class_methods.rb, line 34 def inherited(subclass) subclass.class_eval { include Singleton } subclass.send(:base_file=, File.expand_path(caller.first.split(':').first)) at_exit do if subclass.send(:autorun?) InstanceMethods.instance_method(:run).bind(subclass.instance).call end end end
method_missing(method_name, *args, &block)
click to toggle source
This is used for convinience. Method calls on the class itself are relayed to the singleton instance.
This is called automatically when calling methods on the application class.
@param [Symbol] method_name The name of the method being called @param [Array] args Any arguments that are given to the method @param [Proc] block A block that may be given to the method
# File lib/rubikon/application/class_methods.rb, line 53 def method_missing(method_name, *args, &block) instance.send(method_name, *args, &block) end