Created
February 29, 2012 02:27
-
-
Save gmcinnes/1937078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AbstractMatcher | |
| def summary | |
| raise NotImplementedError, "implement a matcher with the following semantics...." | |
| end | |
| end | |
| class YouTubeMatcher | |
| include AbstractMatcher | |
| def summary | |
| puts "youtube matcher" | |
| end | |
| end | |
| class VimeoMatcher | |
| include AbstractMatcher | |
| def summary | |
| puts "vimeo matcher" | |
| end | |
| end | |
| class Visit | |
| def initialize(url, matcher) | |
| @matcher = matcher | |
| end | |
| def summary | |
| @matcher.summary | |
| end | |
| end | |
| class MatcherFactory | |
| def get_matcher(url) | |
| # choosing matcher logic | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment