gem includes agreements on data structures, which used by meta commit gem to interact with extensions.
Contracts (and their responsibilities) :
- Ast
- stores information about which parser built it
- stores abstract syntax tree
- provides access to children nodes
- provides access to first line number and last line number
- Parser
- builds ast node from code string
- knows about file extensions he supports
- knows about syntax he supports
- ContextualAst
- stores information about which parser built target ast
- stores target ast and all nodes
- Diff
- builds human-readable message of change
- knows what changes it can be used for
- ChangeContext
- stores information about currently examined changes (line, commit id, file name, touched ast)
- passed to diff as source of examined changes
- Locator
- locates exported classes of extension
You can check documentation here
Add this line to your application's Gemfile:
gem 'meta_commit_contracts'
And then execute:
$ bundle
Or install it yourself as:
$ gem install meta_commit_contracts
Inherit components of extension from these classes and override appropriate methods