Sha256: 97da4ced93bebe85be90adb4c61a67229c19ef15f130cd0fcdb2bc055bb3046a

Contents?: true

Size: 1019 Bytes

Versions: 9

Compression:

Stored size: 1019 Bytes

Contents

module NotRelational

class IndexDescription < PropertyDescription
    include SdbFormatter
 attr_accessor :columns
  
    
  def initialize(name,columns,is_encrypted=false)
    self.name=name
    self.columns=columns
    self.value_type =:string
    self.is_primary_key=false
    self.is_encrypted=is_encrypted
  end
  
  def format_index_entry(attribute_descriptions,attribute_values)
   result=""
      columns.each do |column|
        if column.respond_to?(:transform)
          result << column.transform(attribute_values[column.source_column] )
        else
          result << attribute_descriptions[column].format_for_sdb(attribute_values[column]).to_s
        end
        result << "&"
      end
      
      result
  end
  def format_for_sdb(value)
    #don't encrypt because the individual elements are encrypted
    return value
  end
  def keys_match?(h)
    return false unless h.length==columns.length
    columns.each do |c|
      return false unless h.has_key?(c)
    end
    return true
  end
end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cloudwow-not_relational-0.1.0 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.11 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.2 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.3 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.5 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.6 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.7 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.8 lib/not_relational/index_description.rb
cloudwow-not_relational-0.1.9 lib/not_relational/index_description.rb