refactoring: consistency in initialization.

This commit is contained in:
Daniel Ziltener 2023-11-13 00:49:01 +01:00
parent 0b81fcdff2
commit 4810e16b17
2 changed files with 22 additions and 14 deletions

View File

@ -8,11 +8,23 @@ Class {
#category : #Hitch
}
{ #category : #'private - class factory' }
HitchAttribute class >> getResponsibleAttributeClassFor: anAttribute [
^ self allSubclasses detect: [ :attrClass | attrClass handlesAttribute: anAttribute ]
ifNone: [ self ]
]
{ #category : #'private - class factory' }
HitchAttribute class >> handlesAttribute: anAttribute [
^ SubclassResponsibility
]
{ #category : #'instance creation' }
HitchAttribute class >> name: attrName value: attrValue [
^ self new
name: attrName
value: attrValue.
HitchAttribute class >> name: attrName value: attrValue [
^ (self getResponsibleAttributeClassFor: attrName) new name: attrName value: attrValue
]
{ #category : #rendering }

View File

@ -32,22 +32,18 @@ Class {
#category : #Hitch
}
{ #category : #'as yet unclassified' }
{ #category : #'private - class factory' }
HitchElement class >> getResponsibleElementClassFor: aTag [
^ self subclasses detect: [ :subclass | (subclass handlesTag: aTag) ] ifNone: [ self ]
^ self allSubclasses
detect: [ :subclass | subclass handlesTag: aTag ]
ifNone: [ self ]
]
{ #category : #'as yet unclassified' }
{ #category : #'private - class factory' }
HitchElement class >> handlesTag: aTag [
^ false
]
{ #category : #testing }
HitchElement class >> isAbstract [
^ self == HitchElement
^ SubclassResponsibility
]
{ #category : #'instance creation' }