(Not documented)
# File wx/keyword_ctors.rb, line 149 def self.included(klass) klass.extend ClassMethods klass.module_eval do alias :pre_wx_kwctor_init :initialize # The new definition of initialize; accepts a parent arg # mixed_args, which may zero or more position args, optionally # terminated with hash keyword args, and an optional block def initialize(parent = :default_ctor, *mixed_args, &block) # allow zero-args ctor for use with XRC if parent == :default_ctor pre_wx_kwctor_init() return end real_args = [ parent ] + self.class.args_as_list(*mixed_args) begin pre_wx_kwctor_init(*real_args) rescue => err msg = "Error initializing #{self.inspect}\n"+ " : #{err.message} \n" + "Correct parameters for #{self.class.name}.new are:\n" + self.class.describe_constructor() new_err = err.class.new(msg) new_err.set_backtrace(caller) Kernel.raise new_err end # If a block was given, pass the newly created Window instance # into it; use block if block if block.arity == -1 or block.arity == 0 self.instance_eval(&block) elsif block.arity == 1 block.call(self) else Kernel.raise ArgumentError, "Block to initialize accepts zero or one arg" end end end end # Any class inheriting from a class including this module must have # its own copy of the param_spec def klass.inherited(sub_klass) sub_klass.instance_variable_set(:@param_spec, instance_variable_get(:@param_spec) ) end end
The new definition of initialize; accepts a parent arg mixed_args, which may zero or more position args, optionally terminated with hash keyword args, and an optional block
# File wx/keyword_ctors.rb, line 158 def initialize(parent = :default_ctor, *mixed_args, &block) # allow zero-args ctor for use with XRC if parent == :default_ctor pre_wx_kwctor_init() return end real_args = [ parent ] + self.class.args_as_list(*mixed_args) begin pre_wx_kwctor_init(*real_args) rescue => err msg = "Error initializing #{self.inspect}\n"+ " : #{err.message} \n" + "Correct parameters for #{self.class.name}.new are:\n" + self.class.describe_constructor() new_err = err.class.new(msg) new_err.set_backtrace(caller) Kernel.raise new_err end # If a block was given, pass the newly created Window instance # into it; use block if block if block.arity == -1 or block.arity == 0 self.instance_eval(&block) elsif block.arity == 1 block.call(self) else Kernel.raise ArgumentError, "Block to initialize accepts zero or one arg" end end end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.