https://github.com/olekscode/transformationrule
Transformation rule reification based on the Refactoring rules
https://github.com/olekscode/transformationrule
Last synced: 14 days ago
JSON representation
Transformation rule reification based on the Refactoring rules
- Host: GitHub
- URL: https://github.com/olekscode/transformationrule
- Owner: olekscode
- License: mit
- Created: 2020-10-10T11:40:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-02T01:00:44.000Z (almost 4 years ago)
- Last Synced: 2025-02-11T11:41:26.108Z (5 months ago)
- Language: Smalltalk
- Size: 35.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TransformationRule
[](https://travis-ci.org/olekscode/TransformationRule)
[](https://ci.appveyor.com/project/olekscode/transformationrule)
[](https://coveralls.io/github/olekscode/TransformationRule?branch=master)
[](https://raw.githubusercontent.com/olekscode/TransformationRule/master/LICENSE)## How to install it?
To install `TransformationRule`, go to the Playground (Ctrl+OW) in your [Pharo](https://pharo.org/) image and execute the following Metacello script (select it and press Do-it button or Ctrl+D):
```Smalltalk
Metacello new
baseline: 'TransformationRule';
repository: 'github://olekscode/TransformationRule/src';
load.
```## How to depend on it?
If you want to add a dependency on `TransformationRule` to your project, include the following lines into your baseline method:
```Smalltalk
spec
baseline: 'TransformationRule'
with: [ spec repository: 'github://olekscode/TransformationRule/src' ].
```If you are new to baselines and Metacello, check out the [Baselines](https://github.com/pharo-open-documentation/pharo-wiki/blob/master/General/Baselines.md) tutorial on Pharo Wiki.
## How to use it?
```Smalltalk
rule := TransformationRule
antecedent: '`@rec doWithIndex: `@arg'
consequent: '`@rec withIndexDo: `@arg'.
``````Smalltalk
rule := ('`@rec doWithIndex: `@arg' -> '`@rec withIndexDo: `@arg') asTransformationRule.
``````Smalltalk
rule antecedent. "`@rec doWithIndex: `@arg"
rule consequent. "`@rec withIndexDo: `@arg"rule antecedentAST. "RBMessageNode(`@rec doWithIndex: `@arg)"
rule consequentAST. "RBMessageNode(`@rec withIndexDo: `@arg)"rule isValid. "true"
``````Smalltalk
rule applyTo: (Object >> #copySameFrom:).
```