Sha256: 123067611110ad8749c97173e0743e73d9e3e1e3d08b9ef7b1a7c1c7415c70af

Contents?: true

Size: 861 Bytes

Versions: 14

Compression:

Stored size: 861 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
        
        def symbolize!
          @tokens.symbolize
        end
      
      end
      
    end
    
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
picky-4.31.3 lib/picky/query/or.rb
picky-4.31.2 lib/picky/query/or.rb
picky-4.31.1 lib/picky/query/or.rb
picky-4.31.0 lib/picky/query/or.rb
picky-4.30.0 lib/picky/query/or.rb
picky-4.29.0 lib/picky/query/or.rb
picky-4.28.1 lib/picky/query/or.rb
picky-4.27.1 lib/picky/query/or.rb
picky-4.27.0 lib/picky/query/or.rb
picky-4.26.2 lib/picky/query/or.rb
picky-4.26.1 lib/picky/query/or.rb
picky-4.26.0 lib/picky/query/or.rb
picky-4.25.3 lib/picky/query/or.rb
picky-4.25.2 lib/picky/query/or.rb