Fixing an anti-pattern in code and using guard clauses instead.
This commit is contained in:
parent
7725213f7a
commit
d8f4888aa7
@ -67,21 +67,17 @@ TiddlyWiki >> local: aFileRefence [
|
|||||||
|
|
||||||
{ #category : 'accessing' }
|
{ #category : 'accessing' }
|
||||||
TiddlyWiki >> name [
|
TiddlyWiki >> name [
|
||||||
|
| tempName suffix |
|
||||||
^ name ifNil: [
|
name ifNotNil: [ ^ name ].
|
||||||
self file
|
self file ifNotNil: [ ^ name := self file basenameWithoutExtension ].
|
||||||
ifNil: [ | tempName suffix |
|
self remote ifNil: [ ^ name := nil ].
|
||||||
tempName := self remote file.
|
tempName := self remote file.
|
||||||
(tempName endsWithAnyOf: #('.html' '.htm'))
|
(tempName endsWithAnyOf: #('.html' '.htm')) ifTrue: [
|
||||||
ifTrue: [
|
|
||||||
suffix := (tempName splitOn: '.') last.
|
suffix := (tempName splitOn: '.') last.
|
||||||
tempName := tempName removeSuffix: '.', suffix.
|
tempName := tempName removeSuffix: '.', suffix.
|
||||||
].
|
].
|
||||||
name := tempName
|
name := tempName
|
||||||
]
|
]
|
||||||
ifNotNil: [ name := self file basenameWithoutExtension ]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : 'accessing' }
|
{ #category : 'accessing' }
|
||||||
TiddlyWiki >> name: aString [
|
TiddlyWiki >> name: aString [
|
||||||
|
Loading…
Reference in New Issue
Block a user