Project

General

Profile

Bug #7674 » struct.c.diff

iwadon (Hiroyuki Iwatsuki), 01/08/2013 06:31 PM

View differences:

struct.c (working copy)
/*
* call-seq:
* Struct.new( [aString] [, aSym]+> ) -> StructClass
* StructClass.new(arg, ...) -> obj
* StructClass[arg, ...] -> obj
* Struct.new( [aString] [, aSym]+> ) -> StructClass
* Struct.new( [aString] [, aSym]+> ) {|| block } -> StructClass
* StructClass.new(arg, ...) -> obj
* StructClass[arg, ...] -> obj
*
* Creates a new class, named by <i>aString</i>, containing accessor
* methods for the given symbols. If the name <i>aString</i> is
......
* letter. Assigning a structure class to a constant effectively gives
* the class the name of the constant.
*
* If a block is given, it will be evaluated in the context of
* <i>StructClass</i>.
*
* Customer = Struct.new(:name, :address) do
* def greeting
* "Hello #{name}!"
* end
* end
* Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
*
* <code>Struct::new</code> returns a new <code>Class</code> object,
* which can then be used to create specific instances of the new
* structure. The number of actual parameters must be
(1-1/2)