Hello all, I am Hayatou from Cameroon and I was a beginner with smalltalk. I want to implement a " SmalltalkDoc " which takes a class in entry and generate a HTML file. For a beginning I wrote a method smalltalkDoc in the class "Class" here the contents: ------------------------------------------------------------------------------------------- smalltalkDoc "Genere un fichier HTML avec des Information sur une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : ' ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close. ------------------------------------------------------------------ what can I do to have a list of the methods of a class? I am looking for your suggestions. best regards. ------------------------------------ Hayatou |
Hello Hayatou,
Welcome to Pharo ! On 10 Feb 2013, at 19:48, Hayatou Oumarou <[hidden email]> wrote: > Hello all, > I am Hayatou from Cameroon and I was a beginner with smalltalk. I want to implement a " SmalltalkDoc " which takes a class in entry and generate a HTML file. > For a beginning I wrote a method smalltalkDoc in the class "Class" here the contents: > ------------------------------------------------------------------------------------------- > smalltalkDoc > "Genere un fichier HTML avec des Information sur une classe" > |stream nom| > nom:=self asString,'SmalltalkDoc.html'. > stream := FileStream forceNewFileNamed: nom. > stream > nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; > nextPutAll: '</p>'; > nextPutAll: 'class name : '; > nextPutAll: self name asString; > nextPutAll: '</p>'; > nextPutAll: '<p></p>'; > nextPutAll: 'superclass name : '; > nextPutAll: self superclass name asString; > nextPutAll: '<p></p>'; > nextPutAll: '<p></p>'; > nextPutAll: 'trait Composition : '; > nextPutAll: self traitCompositionString asString; > nextPutAll: '<p></p>'; > nextPutAll: '<p></p>'; > nextPutAll: 'class trait Composition : '; > nextPutAll: self class traitCompositionString asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'category : ' ; > nextPutAll: self category asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'instances Variable Names : '; > nextPutAll: self instVarNames asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'pool Dictionary Names : '; > nextPutAll: self poolDictionaryNames asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'class instances Variable Names : '; > nextPutAll: self class instVarNames asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'type of class : '; > nextPutAll: self typeOfClass asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'class Comment : '; > nextPutAll: self organization classComment asString asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'comment Stamp : ' ; > nextPutAll: self organization commentStamp asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'class Variables Names : '; > nextPutAll: self classVarNames asString ; > nextPutAll: '</p>'; > nextPutAll: '</body> </html>'. > stream close. > ------------------------------------------------------------------ > what can I do to have a list of the methods of a class? > I am looking for your suggestions. > best regards. > > ------------------------------------ > Hayatou Classes know about the methods they implement. You can try: String class methodsDo: [ :each | Transcript crShow: each ]. String class selectors. A compiled method as in the first case can be queried further. This is a broad subject and there are many aspects to it. HTH, Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill |
In reply to this post by hayatou
Hayatou
good to see you in this list :) You will learn a lot. You can get the class comment too and the instance variable names. Have a look at the finder too since you can find information using it. Do not hesitate to ask for help and feedback. I suggest you also to create an account on SmalltalkHub or squeaksource3 and publish your code there to learn how to manage it. There is one chapter on monticello and gofer on the pharo by example 2 book. Stef On Feb 10, 2013, at 7:48 PM, Hayatou Oumarou <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |