Sha256: 1100bacb6090e8c1e903bb824dde2f674119a8b919e69108129be5dd624056af

Contents?: true

Size: 547 Bytes

Versions: 7

Compression:

Stored size: 547 Bytes

Contents

# AWEXOME LABS
# DoesKeyValue


module DoesKeyValue
  module Util
  
    module CondArray
      def add_condition(cond, conj="AND")
        if cond.is_a?(Array)
          if self.empty?
            (self << cond).flatten!
          else
            self[0] += " #{conj} #{cond.shift}"
            (self << cond).flatten!
          end
        elsif cond.is_a?(String)
          self[0] += " #{conj} #{cond}"
        else
          raise "Condition must be an Array or String"
        end
        self
      end
    end
  
  end
end # DoesKeyValue

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
doeskeyvalue-0.2.2 lib/doeskeyvalue/util.rb
doeskeyvalue-0.2.1 lib/doeskeyvalue/util.rb
doeskeyvalue-0.2.0 lib/doeskeyvalue/util.rb
doeskeyvalue-0.1.3 lib/doeskeyvalue/util.rb
doeskeyvalue-0.1.2 lib/doeskeyvalue/util.rb
doeskeyvalue-0.1.1 lib/doeskeyvalue/util.rb
doeskeyvalue-0.1.0 lib/doeskeyvalue/util.rb