From 9f28bccc1e0edf25e1d78e0fb32585e1d6ec2554 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 19 Dec 2020 11:24:21 -0500 Subject: [PATCH] Support for BreaOperators --- ...est.class.st => BreaOperatorTest.class.st} | 6 ++--- repository/Brea-Tests/BreaPageTest.class.st | 1 + ...eaQuery.class.st => BreaOperator.class.st} | 24 ++++++++--------- repository/Brea/BreaTheme.class.st | 27 +++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) rename repository/Brea-Tests/{BreaQueryTest.class.st => BreaOperatorTest.class.st} (81%) rename repository/Brea/{BreaQuery.class.st => BreaOperator.class.st} (80%) diff --git a/repository/Brea-Tests/BreaQueryTest.class.st b/repository/Brea-Tests/BreaOperatorTest.class.st similarity index 81% rename from repository/Brea-Tests/BreaQueryTest.class.st rename to repository/Brea-Tests/BreaOperatorTest.class.st index 1917fb2..f0ef1fe 100644 --- a/repository/Brea-Tests/BreaQueryTest.class.st +++ b/repository/Brea-Tests/BreaOperatorTest.class.st @@ -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 ]. diff --git a/repository/Brea-Tests/BreaPageTest.class.st b/repository/Brea-Tests/BreaPageTest.class.st index a6a5485..ef908ee 100644 --- a/repository/Brea-Tests/BreaPageTest.class.st +++ b/repository/Brea-Tests/BreaPageTest.class.st @@ -113,6 +113,7 @@ BreaPageTest >> setUp [ super setUp. self createMarkdownFile. self createHTMLTemplateFile. + self createJSONFile ] { #category : #tests } diff --git a/repository/Brea/BreaQuery.class.st b/repository/Brea/BreaOperator.class.st similarity index 80% rename from repository/Brea/BreaQuery.class.st rename to repository/Brea/BreaOperator.class.st index 789f0d5..8f90d7d 100644 --- a/repository/Brea/BreaQuery.class.st +++ b/repository/Brea/BreaOperator.class.st @@ -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 ] diff --git a/repository/Brea/BreaTheme.class.st b/repository/Brea/BreaTheme.class.st index bc020b0..0b840fd 100644 --- a/repository/Brea/BreaTheme.class.st +++ b/repository/Brea/BreaTheme.class.st @@ -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. ]