Fixing an anti-pattern in code and using guard clauses instead.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-09-14 20:14:20 -05:00
parent 7725213f7a
commit d8f4888aa7

View File

@ -67,21 +67,17 @@ TiddlyWiki >> local: aFileRefence [
{ #category : 'accessing' }
TiddlyWiki >> name [
^ name ifNil: [
self file
ifNil: [ | tempName suffix |
| tempName suffix |
name ifNotNil: [ ^ name ].
self file ifNotNil: [ ^ name := self file basenameWithoutExtension ].
self remote ifNil: [ ^ name := nil ].
tempName := self remote file.
(tempName endsWithAnyOf: #('.html' '.htm'))
ifTrue: [
(tempName endsWithAnyOf: #('.html' '.htm')) ifTrue: [
suffix := (tempName splitOn: '.') last.
tempName := tempName removeSuffix: '.', suffix.
].
name := tempName
]
ifNotNil: [ name := self file basenameWithoutExtension ]
]
]
{ #category : 'accessing' }
TiddlyWiki >> name: aString [