class Cassandra::Types::Custom

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
Calls superclass method Cassandra::Type::new
     # File lib/cassandra/types.rb
1371 def initialize(name)
1372   super(:custom)
1373   @name = name
1374 end

Public Instance Methods

==(other)
Alias for: eql?
assert(value, message = nil, &block) click to toggle source

Asserts that a given value is of this type @param value [Object] value to be validated @param message [String] error message to use when assertion fails @yieldreturn [String] error message to use when assertion fails @raise [ArgumentError] if the value is invalid @return [void]

     # File lib/cassandra/types.rb
1391 def assert(value, message = nil, &block)
1392   Util.assert_instance_of(CustomData, value, message, &block)
1393   Util.assert_equal(self, value.class.type, message, &block)
1394 end
eql?(other) click to toggle source
     # File lib/cassandra/types.rb
1410 def eql?(other)
1411   other.is_a?(Custom) && @name == other.name
1412 end
Also aliased as: ==
hash() click to toggle source
     # File lib/cassandra/types.rb
1401 def hash
1402   @hash ||= begin
1403     h = 17
1404     h = 31 * h + @kind.hash
1405     h = 31 * h + @name.hash
1406     h
1407   end
1408 end
new(*value) click to toggle source

Coerces a given value to this type

@param value [*Object] value to be coerced @return [Object] a value of this type

     # File lib/cassandra/types.rb
1380 def new(*value)
1381   raise ::NotImplementedError,
1382         "unable to create a value for custom type: #{@name.inspect}"
1383 end
to_s() click to toggle source

@return [String] a cassandra representation of this type

     # File lib/cassandra/types.rb
1397 def to_s
1398   "'#{@name}'"
1399 end