Sha256: c8bf554182457d4a21757cf70d1f04cbead8488ec8d8d408875126f5289376b4

Contents?: true

Size: 789 Bytes

Versions: 16

Compression:

Stored size: 789 Bytes

Contents

module Picky

  module Query
    
    class Tokens

      # This is a combination of multiple (already processed) tokens, combined using
      # the OR character, usually | (pipe).
      #
      # It pretends to be a single token and answers to all messages
      # a token would answer to.
      #
      class Or < Tokens
      
        def initialize processed_tokens
          @tokens = processed_tokens
        end
        
        # TODO
        #
        def possible_combinations categories
          combinations = @tokens.inject([]) do |result, token|
            result + token.possible_combinations(categories)
          end
          combinations.empty? && combinations || [Query::Combination::Or.new(combinations)]
        end
      
      end
      
    end
    
  end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
picky-4.25.1 lib/picky/query/or.rb
picky-4.25.0 lib/picky/query/or.rb
picky-4.24.0 lib/picky/query/or.rb
picky-4.23.2 lib/picky/query/or.rb
picky-4.23.1 lib/picky/query/or.rb
picky-4.23.0 lib/picky/query/or.rb
picky-4.22.0 lib/picky/query/or.rb
picky-4.21.2 lib/picky/query/or.rb
picky-4.21.1 lib/picky/query/or.rb
picky-4.21.0 lib/picky/query/or.rb
picky-4.20.2 lib/picky/query/or.rb
picky-4.20.1 lib/picky/query/or.rb
picky-4.20.0 lib/picky/query/or.rb
picky-4.19.7 lib/picky/query/or.rb
picky-4.19.6 lib/picky/query/or.rb
picky-4.19.5 lib/picky/query/or.rb