The Trunk: Kernel-ul.941.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-ul.941.mcz

commits-2
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.941.mcz

==================== Summary ====================

Name: Kernel-ul.941
Author: ul
Time: 14 August 2015, 10:13:29.228 pm
UUID: fc6d8eaf-1f0b-459c-9ff7-89c0a607ec72
Ancestors: Kernel-ul.940

- added support for regular expressions to BlockClosure >> #valueSupplyingAnswers:

=============== Diff against Kernel-ul.940 ===============

Item was changed:
  ----- Method: BlockClosure>>valueSupplyingAnswers: (in category 'evaluating') -----
  valueSupplyingAnswers: aListOfPairs
  "evaluate the block using a list of questions / answers that might be called upon to
  automatically respond to Object>>confirm: or FillInTheBlank requests"
 
  ^self
  on: ProvideAnswerNotification
  do: [ :notification |
  | caption |
  caption := notification messageText withSeparatorsCompacted. "to remove new lines"
  aListOfPairs
  detect:  [ :each |
  caption = each first
  or: [ (caption includesSubstring: each first caseSensitive: false)
+ or: [ (each first match: caption)
+ or: [ (caption respondsTo: #matchesRegex:)
+ and: [ caption matchesRegex: each first ] ] ] ] ]
- or: [ each first match: caption ] ] ]
  ifFound: [ :answer | notification resume: answer second ]
  ifNone: [
  (ProvideAnswerNotification signal: notification messageText)
  ifNil: [ notification resume ]
  ifNotNil: [ :outerAnswer | notification resume: outerAnswer ] ] ]!