Support for BreaOperators
This commit is contained in:
parent
9f0f06d285
commit
9f28bccc1e
@ -2,16 +2,16 @@
|
||||
A BreaQueryTest is a test class for testing the behavior of BreaQuery
|
||||
"
|
||||
Class {
|
||||
#name : #BreaQueryTest,
|
||||
#name : #BreaOperatorTest,
|
||||
#superclass : #TestCase,
|
||||
#category : #'Brea-Tests'
|
||||
}
|
||||
|
||||
{ #category : #tests }
|
||||
BreaQueryTest >> testSTONSerialization [
|
||||
BreaOperatorTest >> testSTONSerialization [
|
||||
|
||||
| original store deserialized |
|
||||
original := BreaQuery new
|
||||
original := BreaOperator new
|
||||
name: 'plus';
|
||||
inputs: {'a' -> 3. 'b' -> 4} asDictionary;
|
||||
codeBlock: [ :x :y | x + y ].
|
@ -113,6 +113,7 @@ BreaPageTest >> setUp [
|
||||
super setUp.
|
||||
self createMarkdownFile.
|
||||
self createHTMLTemplateFile.
|
||||
self createJSONFile
|
||||
]
|
||||
|
||||
{ #category : #tests }
|
||||
|
@ -20,7 +20,7 @@ Internal Representation and Key Implementation Points.
|
||||
Implementation Points
|
||||
"
|
||||
Class {
|
||||
#name : #BreaQuery,
|
||||
#name : #BreaOperator,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'name',
|
||||
@ -32,12 +32,12 @@ Class {
|
||||
}
|
||||
|
||||
{ #category : #converting }
|
||||
BreaQuery >> asSton [
|
||||
BreaOperator >> asSton [
|
||||
^ STON toStringPretty: self
|
||||
]
|
||||
|
||||
{ #category : #converting }
|
||||
BreaQuery >> cleanInputs [
|
||||
BreaOperator >> cleanInputs [
|
||||
self cleanedInputs ifNil: [ ^ self ].
|
||||
self cleanedInputs ifTrue: [
|
||||
self inputs keysAndValuesDo: [ :k :v | | currentValue |
|
||||
@ -48,48 +48,48 @@ BreaQuery >> cleanInputs [
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> cleanedInputs [
|
||||
BreaOperator >> cleanedInputs [
|
||||
^ cleanedInputs
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> cleanedInputs: aBoolean [
|
||||
BreaOperator >> cleanedInputs: aBoolean [
|
||||
"I tell if the inputs should be cleaned when the query is serialized as STON, for
|
||||
example when they contain sensible information, like API keys or passwords"
|
||||
cleanedInputs := aBoolean
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> codeBlock [
|
||||
BreaOperator >> codeBlock [
|
||||
^ codeBlock
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> codeBlock: anObject [
|
||||
BreaOperator >> codeBlock: anObject [
|
||||
codeBlock := anObject
|
||||
]
|
||||
|
||||
{ #category : #execution }
|
||||
BreaQuery >> execute [
|
||||
BreaOperator >> execute [
|
||||
^ self codeBlock valueWithArguments: self inputs values.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> inputs [
|
||||
BreaOperator >> inputs [
|
||||
^ inputs
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> inputs: anOrderedDictionary [
|
||||
BreaOperator >> inputs: anOrderedDictionary [
|
||||
inputs := anOrderedDictionary
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> name [
|
||||
BreaOperator >> name [
|
||||
^ name
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaQuery >> name: anObject [
|
||||
BreaOperator >> name: anObject [
|
||||
name := anObject
|
||||
]
|
@ -32,8 +32,7 @@ Class {
|
||||
'url',
|
||||
'preview',
|
||||
'license',
|
||||
'queries',
|
||||
'customizations'
|
||||
'operators'
|
||||
],
|
||||
#category : #Brea
|
||||
}
|
||||
@ -103,8 +102,8 @@ BreaTheme class >> downloadLinks [
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
BreaTheme >> addQuery: aBreaQuery [
|
||||
self queries add: aBreaQuery cleanInputs
|
||||
BreaTheme >> addOperator: aBreaQuery [
|
||||
self operators add: aBreaQuery cleanInputs
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
@ -184,6 +183,16 @@ BreaTheme >> name: anObject [
|
||||
name := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaTheme >> operators [
|
||||
^ operators ifNil: [ operators := OrderedCollection new ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaTheme >> operators: cleanedBreaQueriesCollection [
|
||||
operators := cleanedBreaQueriesCollection
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaTheme >> preview [
|
||||
^ preview
|
||||
@ -204,16 +213,6 @@ BreaTheme >> provider: anObject [
|
||||
provider := anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaTheme >> queries [
|
||||
^ queries ifNil: [ queries := OrderedCollection new ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaTheme >> queries: cleanedBreaQueriesCollection [
|
||||
queries := cleanedBreaQueriesCollection
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaTheme >> url [
|
||||
^ url ifNil: [ url := self class downloadLinks at: self name. ]
|
||||
|
Loading…
Reference in New Issue
Block a user