Browse Source

Some class comments and doc improvements

Nicolas Petton 13 years ago
parent
commit
4137b8da03
6 changed files with 168 additions and 13 deletions
  1. 6 0
      css/documentation.css
  2. 39 2
      js/Documentation.deploy.js
  3. 58 6
      js/Documentation.js
  4. 0 0
      js/Kernel-Objects.js
  5. 20 4
      st/Documentation.st
  6. 45 1
      st/Kernel-Objects.st

+ 6 - 0
css/documentation.css

@@ -30,6 +30,12 @@
     padding: 5px;
 }
 
+.documentation code {
+    background: #eee;
+    padding: 0 5px;
+}
+
+
 .documentation .menu {
     position: fixed;
     left: 0;

+ 39 - 2
js/Documentation.deploy.js

@@ -128,7 +128,7 @@ smalltalk.method({
 selector: 'ch6KernelObjects',
 fn: function (){
 var self=this;
-return (function($rec){smalltalk.send($rec, "_title_", [unescape("Kernel-Objects")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", [unescape("Kernel-Objects")])]));
+return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", [unescape("Kernel-Objects")])]);
 return self;}
 }),
 smalltalk.DocumentationBuilder);
@@ -158,6 +158,43 @@ return self;}
 }),
 smalltalk.DocumentationBuilder);
 
+smalltalk.addMethod(
+'_ch7KernelClasses',
+smalltalk.method({
+selector: 'ch7KernelClasses',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", [unescape("Kernel-Classes")])]);
+return self;}
+}),
+smalltalk.DocumentationBuilder);
+
+smalltalk.addMethod(
+'_update',
+smalltalk.method({
+selector: 'update',
+fn: function (){
+var self=this;
+self['@chapters']=nil;
+self['@announcer']=nil;
+self['@widget']=nil;
+smalltalk.send(smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", [".documentation"]), "_remove", []);
+smalltalk.send(self, "_build", []);
+return self;}
+}),
+smalltalk.DocumentationBuilder);
+
+smalltalk.addMethod(
+'_build',
+smalltalk.method({
+selector: 'build',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_buildOnJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
+return self;}
+}),
+smalltalk.DocumentationBuilder);
+
 
 smalltalk.DocumentationBuilder.klass.iVarNames = ['current'];
 smalltalk.addMethod(
@@ -166,7 +203,7 @@ smalltalk.method({
 selector: 'initialize',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self, "_current", []), "_buildOnJQuery_", [smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", ["body"])]);
+smalltalk.send(smalltalk.send(self, "_current", []), "_build", []);
 return self;}
 }),
 smalltalk.DocumentationBuilder.klass);

+ 58 - 6
js/Documentation.js

@@ -184,11 +184,11 @@ selector: unescape('ch6KernelObjects'),
 category: 'chapters',
 fn: function (){
 var self=this;
-return (function($rec){smalltalk.send($rec, "_title_", [unescape("Kernel-Objects")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", [unescape("Kernel-Objects")])]));
+return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", [unescape("Kernel-Objects")])]);
 return self;},
 args: [],
-source: unescape('ch6KernelObjects%0A%09%5E%28PackageDocChapter%20on%3A%20%28Package%20named%3A%20%27Kernel-Objects%27%29%29%0A%09%09title%3A%20%27Kernel-Objects%27%3B%0A%09%09yourself'),
-messageSends: ["title:", "yourself", "on:", "named:"],
+source: unescape('ch6KernelObjects%0A%09%5EPackageDocChapter%20on%3A%20%28Package%20named%3A%20%27Kernel-Objects%27%29'),
+messageSends: ["on:", "named:"],
 referencedClasses: ["PackageDocChapter", "Package"]
 }),
 smalltalk.DocumentationBuilder);
@@ -228,6 +228,58 @@ referencedClasses: ["ChapterSelectionAnnouncement"]
 }),
 smalltalk.DocumentationBuilder);
 
+smalltalk.addMethod(
+unescape('_ch7KernelClasses'),
+smalltalk.method({
+selector: unescape('ch7KernelClasses'),
+category: 'chapters',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", [unescape("Kernel-Classes")])]);
+return self;},
+args: [],
+source: unescape('ch7KernelClasses%0A%09%5EPackageDocChapter%20on%3A%20%28Package%20named%3A%20%27Kernel-Classes%27%29'),
+messageSends: ["on:", "named:"],
+referencedClasses: ["PackageDocChapter", "Package"]
+}),
+smalltalk.DocumentationBuilder);
+
+smalltalk.addMethod(
+unescape('_update'),
+smalltalk.method({
+selector: unescape('update'),
+category: 'updating',
+fn: function (){
+var self=this;
+self['@chapters']=nil;
+self['@announcer']=nil;
+self['@widget']=nil;
+smalltalk.send(smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", [".documentation"]), "_remove", []);
+smalltalk.send(self, "_build", []);
+return self;},
+args: [],
+source: unescape('update%0A%09chapters%20%3A%3D%20nil.%0A%09announcer%20%3A%3D%20nil.%0A%09widget%20%3A%3D%20nil.%0A%09%28window%20jQuery%3A%20%27.documentation%27%29%20remove.%0A%09self%20build'),
+messageSends: ["remove", "jQuery:", "build"],
+referencedClasses: []
+}),
+smalltalk.DocumentationBuilder);
+
+smalltalk.addMethod(
+unescape('_build'),
+smalltalk.method({
+selector: unescape('build'),
+category: 'building',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_buildOnJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
+return self;},
+args: [],
+source: unescape('build%0A%09self%20buildOnJQuery%3A%20%28%27body%27%20asJQuery%29'),
+messageSends: ["buildOnJQuery:", "asJQuery"],
+referencedClasses: []
+}),
+smalltalk.DocumentationBuilder);
+
 
 smalltalk.DocumentationBuilder.klass.iVarNames = ['current'];
 smalltalk.addMethod(
@@ -237,11 +289,11 @@ selector: unescape('initialize'),
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self, "_current", []), "_buildOnJQuery_", [smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", ["body"])]);
+smalltalk.send(smalltalk.send(self, "_current", []), "_build", []);
 return self;},
 args: [],
-source: unescape('initialize%0A%09self%20current%20buildOnJQuery%3A%20%28window%20jQuery%3A%20%27body%27%29'),
-messageSends: ["buildOnJQuery:", "current", "jQuery:"],
+source: unescape('initialize%0A%09self%20current%20build'),
+messageSends: ["build", "current"],
 referencedClasses: []
 }),
 smalltalk.DocumentationBuilder.klass);

File diff suppressed because it is too large
+ 0 - 0
js/Kernel-Objects.js


+ 20 - 4
st/Documentation.st

@@ -34,6 +34,10 @@ buildOn: aCanvas
 
 buildOnJQuery: aJQuery
 	self buildOn: (HTMLCanvas onJQuery: aJQuery)
+!
+
+build
+	self buildOnJQuery: ('body' asJQuery)
 ! !
 
 !DocumentationBuilder methodsFor: 'chapters'!
@@ -232,9 +236,11 @@ ch5Index
 !
 
 ch6KernelObjects
-	^(PackageDocChapter on: (Package named: 'Kernel-Objects'))
-		title: 'Kernel-Objects';
-		yourself
+	^PackageDocChapter on: (Package named: 'Kernel-Objects')
+!
+
+ch7KernelClasses
+	^PackageDocChapter on: (Package named: 'Kernel-Classes')
 ! !
 
 !DocumentationBuilder methodsFor: 'routing'!
@@ -251,6 +257,16 @@ checkHash
 		yourself)
 ! !
 
+!DocumentationBuilder methodsFor: 'updating'!
+
+update
+	chapters := nil.
+	announcer := nil.
+	widget := nil.
+	(window jQuery: '.documentation') remove.
+	self build
+! !
+
 DocumentationBuilder class instanceVariableNames: 'current'!
 
 !DocumentationBuilder class methodsFor: 'accessing'!
@@ -262,7 +278,7 @@ current
 !DocumentationBuilder class methodsFor: 'initialization'!
 
 initialize
-	self current buildOnJQuery: (window jQuery: 'body')
+	self current build
 ! !
 
 Widget subclass: #DocChapter

+ 45 - 1
st/Kernel-Objects.st

@@ -2,6 +2,42 @@ Smalltalk current createPackage: 'Kernel-Objects' properties: #{}!
 nil subclass: #Object
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
+!Object commentStamp!
+*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.
+
+Object provides default behavior common to all normal objects, such as: 
+
+- access
+- copying
+- comparison
+- error handling
+- message sending
+- reflection
+
+Also utility messages that all objects should respond to are defined here.
+
+Object has no instance variable.
+
+##Access
+
+Instance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.
+Accessing JavaScript properties if an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.
+
+##Copying
+
+Copying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.
+The hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.
+
+##Comparison
+
+Objects understand equality  `#=` and identity `#==` comparison.
+
+##Error handling
+
+- `#halt` is the typical message to use for inserting breakpoints during debugging.
+- `#error:` throws a generic error exception
+- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.
+  Overriding this message can be useful to implement proxies for example.!
 
 !Object methodsFor: 'accessing'!
 
@@ -824,6 +860,11 @@ pi
 Object subclass: #Boolean
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
+!Boolean commentStamp!
+Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.
+
+Boolean defines the protocol for logic testing operations and conditional control structures for the logical values.
+Boolean instances are weither `true` or `false`.!
 
 !Boolean methodsFor: 'comparing'!
 
@@ -916,7 +957,10 @@ Object subclass: #Date
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
 !Date commentStamp!
-The Date class is used to work with dates and times.!
+The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in
+Amber and answer the same date object.
+
+Date wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects.!
 
 !Date methodsFor: 'accessing'!
 

Some files were not shown because too many files changed in this diff