Is it possible to file out a class hierarchy ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to file out a class hierarchy ?

Paul DeBruicker
From a playground or nautilus is is possible to file out a class and all of its subclasses into one file out?  The subclasses are in different packages, which I think is a confounding factor.  



Thanks


Paul
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to file out a class hierarchy ?

Denis Kudriashov
You could evaluate YourClass allSubclassesDo: #fileOut

2016-11-17 18:16 GMT+01:00 PAUL DEBRUICKER <[hidden email]>:
From a playground or nautilus is is possible to file out a class and all of its subclasses into one file out?  The subclasses are in different packages, which I think is a confounding factor.



Thanks


Paul

Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to file out a class hierarchy ?

Henrik Nergaard-2
In reply to this post by Paul DeBruicker

| aStream aClass |

aStream := '' writeStream.
aClass := FTFilter.

FTFilter fileOutOn: aStream.
FTFilter allSubclassesDo: [ :cls |
        cls fileOutOn: aStream
].

"(ChunkFileFormatParser for: aStream contents readStream) parseChunks"

-------------------------------

Best regards,
Henrik

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of PAUL DEBRUICKER
Sent: Thursday, November 17, 2016 6:16 PM
To: Any question about pharo is welcome <[hidden email]>
Subject: [Pharo-users] Is it possible to file out a class hierarchy ?

From a playground or nautilus is is possible to file out a class and all of its subclasses into one file out?  The subclasses are in different packages, which I think is a confounding factor.  



Thanks


Paul

Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to file out a class hierarchy ?

Paul DeBruicker
Thanks to you both.

This is what I ended up with:

|class file stream|
class:=MyClass .
file:=(class name asString, '-hierarchy.st') asFileReference.
stream:=file writeStream.
class fileOutOn:stream.
class allSubclassesDo: [ :cls |
        cls fileOutOn: stream.
         ].
stream close.




Henrik Nergaard-2 wrote
| aStream aClass |

aStream := '' writeStream.
aClass := FTFilter.

FTFilter fileOutOn: aStream.
FTFilter allSubclassesDo: [ :cls |
        cls fileOutOn: aStream
].

"(ChunkFileFormatParser for: aStream contents readStream) parseChunks"

-------------------------------

Best regards,
Henrik

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of PAUL DEBRUICKER
Sent: Thursday, November 17, 2016 6:16 PM
To: Any question about pharo is welcome <[hidden email]>
Subject: [Pharo-users] Is it possible to file out a class hierarchy ?

From a playground or nautilus is is possible to file out a class and all of its subclasses into one file out?  The subclasses are in different packages, which I think is a confounding factor.  



Thanks


Paul