Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Uri: add displayPathOn:, displayQueryOn: and displayFragmentOn:

  • Loading branch information...
commit 22a629c6b28236ff557e5ebbc24c33bbabf8ddbb 1 parent b548d0d
@lm authored
Showing with 22 additions and 3 deletions.
  1. +22 −3 libs/Uri.st
View
25 libs/Uri.st
@@ -212,16 +212,35 @@ Object subclass: Uri [
aStream
nextPutAll: scheme;
nextPutAll: '://';
- print: authority;
+ print: authority.
+
+ self
+ displayPathOn: aStream;
+ displayQueryOn: aStream;
+ displayFragmentOn: aStream.
+ ]
+
+ displayPathOn: aStream [
+ <category: 'printing'>
+
+ aStream
nextPut: $/;
nextPutAll: (percentEncoding encode: path skip: '-._~/').
+ ]
+
+ displayQueryOn: aStream [
+ <category: 'printing'>
- query size = 0 ifFalse: [
+ query notEmpty ifTrue: [
aStream
nextPut: $?;
nextPutAll: self queryAsString].
+ ]
+
+ displayFragmentOn: aStream [
+ <category: 'printing'>
- fragment isEmpty ifFalse: [
+ fragment notEmpty ifTrue: [
aStream
nextPut: $#;
nextPutAll: self fragment].
Please sign in to comment.
Something went wrong with that request. Please try again.