class Cequel::Schema::TableProperty

Encapsulates a CQL3 storage property defined on a table

Attributes

name[R]

@return [Symbol] name of the property

value[R]

@return value of the property

Public Class Methods

build(name, value) click to toggle source

Initialize an instance of the appropriate TableProperty implementation.

@param (see initialize) @api private

# File lib/cequel/schema/table_property.rb, line 18
def self.build(name, value)
  clazz =
    case name.to_sym
    when :compaction then CompactionProperty
    when :compression then CompressionProperty
    else TableProperty
    end
  clazz.new(name, value)
end

Protected Class Methods

new(name, value) click to toggle source

@param name [Symbol] name of the property @param value value of the property

# File lib/cequel/schema/table_property.rb, line 32
def initialize(name, value)
  @name = name
  self.normalized_value = value
end

Public Instance Methods

==(other) click to toggle source

Returns true iff `self` and `other` logically equivalent (same value for same property).

# File lib/cequel/schema/table_property.rb, line 49
def ==(other)
  other.name == self.name &&
    other.value == self.value
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source

Returns a hash code for this object

# File lib/cequel/schema/table_property.rb, line 56
def hash
  [name, value].hash
end
to_cql() click to toggle source

@return [String] CQL fragment defining this property in a `CREATE

TABLE` statement
# File lib/cequel/schema/table_property.rb, line 42
def to_cql
  "#{@name} = #{value_cql}"
end

Protected Instance Methods

normalized_value=(value) click to toggle source
# File lib/cequel/schema/table_property.rb, line 62
def normalized_value=(value)
  @value = value
end

Private Instance Methods

quote(value) click to toggle source
# File lib/cequel/schema/table_property.rb, line 72
def quote(value)
  Cequel::Type.quote(value)
end
value_cql() click to toggle source
# File lib/cequel/schema/table_property.rb, line 68
def value_cql
  quote(@value)
end