Skip to content

Commit

Permalink
Merge branch 'feature/ghi-#6-plugin-api' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
arcticicestudio committed Jan 7, 2017
2 parents 5bb0873 + c4b10b7 commit 7bee974
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions snowsaw/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from .logging import Logger
from .context import Context


class Plugin(object):
"""
A abstract base class for plugins that process directives.
"""
def __init__(self, context):
self._context = context
self._log = Logger()

def can_handle(self, directive):
"""
Checks if the plugin can handle the specified directive.
:param directive: The directive to check
:return: True if the specified directive can be handled, False otherwise
"""
raise NotImplementedError

def handle(self, directive, data):
"""
Handles the data of the specified directive.
:param directive: The directive to handle the data of
:param data: The data to handle
:return: True if the directive has been handled successfully
"""
raise NotImplementedError

0 comments on commit 7bee974

Please sign in to comment.