Coder

Coder is a set of components for creating and manipulating code.

Method coder

The smallest unit is the GtPharoMethodCoder GtPharoSourceCoder subclass: #GtPharoMethodCoder instanceVariableNames: 'methodBehavior selector' classVariableNames: '' package: 'GToolkit-Pharo-Coder-Method-Coder' which, as the name says, focuses on editing one single method.

The method coder can mold dynamically to fit the context of the current method. For example, when the method is annotated with <gtExample>, the coder is embellished with the possibility to run the method as an example, and see the result as a label. This happens dynamically. Give it a try below.

Filters

Method coders can be combined in different ways for different purposes. One of these purposes is searching. This is achieved by means of GtSearchMethodsFilter GtSearchTypedEntitiesFilter subclass: #GtSearchMethodsFilter instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-Pharo-SearchFilters-Filters' .

For example, below you see the result of a code query. Expanding the resulting method coders highlights the specific nodes that matched the query.

gtExamplePragmas
	<gtExample>
	| filter |
	filter := #gtExample gtPragmas.
	self assert: filter notEmpty.
	self assert: (filter matches: thisContext method).
	^ filter
    

See GtSearchMethodFilterExamples Object subclass: #GtSearchMethodFilterExamples instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-Pharo-Coder-Examples-Filters' for more details.