-
Notifications
You must be signed in to change notification settings - Fork 17
Adding comments + extend default error #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| Extension { #name : 'Object' } | ||
|
|
||
| { #category : '*mustache-core' } | ||
| Object >> mustacheDefaultWhenLookupFails [ | ||
| Object >> mustacheDefaultWhenLookupFails: failingPartString [ | ||
|
|
||
| ^ nil | ||
| ] | ||
|
|
||
|
|
@@ -17,10 +18,14 @@ Object >> mustacheDo: aBlock inverted: aBoolean [ | |
|
|
||
| { #category : '*mustache-core' } | ||
| Object >> mustacheLookup: aString [ | ||
| "The lookup supports navigation between objects using messages expressed by $. | ||
|
|
||
| For example {{{ site.configuration }}} means that the template accesses the value returned by the message configuration sent to the result of the message site." | ||
|
|
||
| (aString = '.') ifTrue: [ ^ self ]. | ||
| ^ [ self perform: aString asSymbol ] | ||
| on: MessageNotUnderstood | ||
| do: [ :err | self mustacheLookupComplex: aString ] | ||
| ^ (self respondsTo: aString asSymbol) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want to change that. Asking before performing is way slower and unnecessary. I think a piece of code should support the intended case first. Just execution method assumes that it goes well most of the time so no check needed, just a guard. Defensively asking before is rather the exception that it often does not respondTo: . A short check turns out this new version is more than 5 times slower |
||
| ifTrue: [ self perform: aString asSymbol ] | ||
| ifFalse: [ self mustacheLookupComplex: aString ] | ||
| ] | ||
|
|
||
| { #category : '*mustache-core' } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need change the sender of this method as well. Now we get a DNU