Permalink
Browse files

Removes PositionalRelationDelegators from Base

Instead of adding it to all brackets that inherit from base, explicitly add to
SingleElimination and DoubleElimination.  Other bracket types have no use for this
system, because PositionalRelation does not work (Swiss, for example).
  • Loading branch information...
1 parent 5728ae9 commit ac48b18dbaa94c443ceadbcad2f9f8dabe69e010 @cadwallion cadwallion committed Aug 18, 2012
@@ -26,8 +26,6 @@ module Bracket
class Base
class NoTemplateError < Exception ; end
- include PositionalRelationDelegators
-
class << self
def by_size size, options = {}
generate_from_template @template, size
@@ -2,6 +2,7 @@ module BracketTree
module Bracket
class DoubleElimination < Base
template BracketTree::Template::DoubleElimination
+ include PositionalRelationDelegators
end
end
end
@@ -2,6 +2,7 @@ module BracketTree
module Bracket
class SingleElimination < Base
template BracketTree::Template::SingleElimination
+ include PositionalRelationDelegators
end
end
end
@@ -150,6 +150,17 @@ def round number
end
end
+ # This module provides the delegation used for PositionalRelation. Including this
+ # module results in brackets gaining the understanding of the positional relation
+ # traversal system.
+ #
+ # @example
+ # class CrazyBracket < BracketTree::Bracket::Base
+ # include BracketTree::PositionalRelation
+ # end
+ #
+ # bracket = CrazyBracket.new
+ # bracket.winners.all # => []
module PositionalRelationDelegators
extend Forwardable

0 comments on commit ac48b18

Please sign in to comment.