Class: Cequel::Schema::TableProperty
- Inherits:
-
Object
- Object
- Cequel::Schema::TableProperty
- Defined in:
- lib/cequel/schema/table_property.rb
Overview
Encapsulates a CQL3 storage property defined on a table
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Symbol
readonly
Name of the property.
-
#value ⇒ Object
readonly
Value of the property.
Class Method Summary collapse
-
.build(name, value) ⇒ Object
private
Initialize an instance of the appropriate TableProperty implementation.
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Returns true iff ‘self` and `other` logically equivalent (same value for same property).
-
#hash ⇒ Object
Returns a hash code for this object.
-
#initialize(name, value) ⇒ TableProperty
constructor
A new instance of TableProperty.
-
#to_cql ⇒ String
CQL fragment defining this property in a ‘CREATE TABLE` statement.
Constructor Details
#initialize(name, value) ⇒ TableProperty
Returns a new instance of TableProperty.
33 34 35 36 |
# File 'lib/cequel/schema/table_property.rb', line 33 def initialize(name, value) @name = name self.normalized_value = value end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
Returns name of the property.
9 10 11 |
# File 'lib/cequel/schema/table_property.rb', line 9 def name @name end |
#value ⇒ Object (readonly)
Returns value of the property.
11 12 13 |
# File 'lib/cequel/schema/table_property.rb', line 11 def value @value end |
Class Method Details
.build(name, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize an instance of the appropriate TableProperty implementation.
19 20 21 22 23 24 25 26 27 |
# File 'lib/cequel/schema/table_property.rb', line 19 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 |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Returns true iff ‘self` and `other` logically equivalent (same value for same property).
50 51 52 53 |
# File 'lib/cequel/schema/table_property.rb', line 50 def ==(other) other.name == self.name && other.value == self.value end |
#hash ⇒ Object
Returns a hash code for this object
57 58 59 |
# File 'lib/cequel/schema/table_property.rb', line 57 def hash [name, value].hash end |
#to_cql ⇒ String
Returns CQL fragment defining this property in a ‘CREATE TABLE` statement.
43 44 45 |
# File 'lib/cequel/schema/table_property.rb', line 43 def to_cql "#{@name} = #{value_cql}" end |