The Inbox: Network-fbs.80.mcz

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

The Inbox: Network-fbs.80.mcz

commits-2
A new version of Network was added to project The Inbox:
http://source.squeak.org/inbox/Network-fbs.80.mcz

==================== Summary ====================

Name: Network-fbs.80
Author: fbs
Time: 1 September 2010, 10:12:46.067 pm
UUID: ed5bacf0-62f0-c84a-aa36-13d320b0bee9
Ancestors: Network-fbs.79

Devolve responsibility of deciding which Url subclass to instantiate by asking the subclasses directly (in reverse topological order, by inheritance).

=============== Diff against Network-ar.78 ===============

Item was added:
+ ----- Method: BrowserUrl class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aString
+ ^ aString asLowercase = 'browser'.!

Item was added:
+ ----- Method: MailtoUrl class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aString
+ ^ aString asLowercase = 'mailto'.!

Item was added:
+ ----- Method: Url class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aString
+ ^ false.!

Item was added:
+ ----- Method: HttpUrl class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aString
+ aString ifNil: [^true].
+ ^ aString asLowercase = 'http'.!

Item was added:
+ ----- Method: GenericUrl class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aScheme
+ "Being generic, a GenericUrl understands the basic structure of all URLs."
+ ^ true.!

Item was added:
+ ----- Method: FileUrl class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aString
+ ^ aString asLowercase = 'file'.!

Item was added:
+ ----- Method: FtpUrl class>>handlesScheme: (in category 'testing') -----
+ handlesScheme: aString
+ ^ aString asLowercase = 'ftp'.!

Item was changed:
  ----- Method: Url class>>urlClassForScheme: (in category 'parsing') -----
  urlClassForScheme: scheme
+ scheme ifNil: [^HttpUrl].
+ ^ self allSubclasses reverse detect: [:each | each handlesScheme: scheme] ifNone: [GenericUrl].!
- (scheme isNil or: [scheme = 'http']) ifTrue: [^HttpUrl].
- scheme = 'ftp' ifTrue: [^FtpUrl].
- scheme = 'file' ifTrue: [^FileUrl].
- scheme = 'mailto' ifTrue: [^MailtoUrl].
- scheme = 'browser' ifTrue: [^BrowserUrl].
- ^GenericUrl!