Skip to content

Commit

Permalink
Review and clean Login>>#host
Browse files Browse the repository at this point in the history
Fix #132
  • Loading branch information
astares committed Jul 15, 2023
1 parent 62298c4 commit a656e14
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Glorp/Login.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,16 @@ Login >> hash [
Login >> host [
"connect string looks like hostname:portNumber_db-name.
:portNumber is optional"

| str portIndex index dbIndex |
host == nil
ifFalse: [^ host].
host == nil
ifTrue: [str := self connectString.
portIndex := index := str indexOf: $:.
dbIndex := str indexOf: $_.
index = 0 ifTrue: [index := dbIndex].
host := index > 0
ifTrue: [ str copyFrom: 1 to: index - 1 ].
^ host]
host ifNotNil: [ ^ host ].

str := self connectString.
portIndex := index := str indexOf: $:.
dbIndex := str indexOf: $_.
index = 0 ifTrue: [ index := dbIndex ].
host := index > 0 ifTrue: [ str copyFrom: 1 to: index - 1 ].
^ host
]

{ #category : #accessing }
Expand Down

0 comments on commit a656e14

Please sign in to comment.