Class: Cassandra::Types::Custom
- Inherits:
-
Cassandra::Type
- Object
- Cassandra::Type
- Cassandra::Types::Custom
- Defined in:
- lib/cassandra/types.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Cassandra::Type
Instance Method Summary collapse
-
#assert(value, message = nil, &block) ⇒ void
Asserts that a given value is of this type.
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(name) ⇒ Custom
constructor
A new instance of Custom.
-
#new(*value) ⇒ Object
Coerces a given value to this type.
-
#to_s ⇒ String
A cassandra representation of this type.
Constructor Details
#initialize(name) ⇒ Custom
1371 1372 1373 1374 |
# File 'lib/cassandra/types.rb', line 1371 def initialize(name) super(:custom) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
1369 1370 1371 |
# File 'lib/cassandra/types.rb', line 1369 def name @name end |
Instance Method Details
#assert(value, message = nil, &block) ⇒ void
This method returns an undefined value.
Asserts that a given value is of this type
1391 1392 1393 1394 |
# File 'lib/cassandra/types.rb', line 1391 def assert(value, = nil, &block) Util.assert_instance_of(CustomData, value, , &block) Util.assert_equal(self, value.class.type, , &block) end |
#eql?(other) ⇒ Boolean Also known as: ==
1410 1411 1412 |
# File 'lib/cassandra/types.rb', line 1410 def eql?(other) other.is_a?(Custom) && @name == other.name end |
#hash ⇒ Object
1401 1402 1403 1404 1405 1406 1407 1408 |
# File 'lib/cassandra/types.rb', line 1401 def hash @hash ||= begin h = 17 h = 31 * h + @kind.hash h = 31 * h + @name.hash h end end |
#new(*value) ⇒ Object
Coerces a given value to this type
1380 1381 1382 1383 |
# File 'lib/cassandra/types.rb', line 1380 def new(*value) raise ::NotImplementedError, "unable to create a value for custom type: #{@name.inspect}" end |
#to_s ⇒ String
1397 1398 1399 |
# File 'lib/cassandra/types.rb', line 1397 def to_s "'#{@name}'" end |