Skip to content

Instantly share code, notes, and snippets.

@gmcinnes
Created February 29, 2012 02:27
Show Gist options
  • Select an option

  • Save gmcinnes/1937078 to your computer and use it in GitHub Desktop.

Select an option

Save gmcinnes/1937078 to your computer and use it in GitHub Desktop.
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