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
1412 def initialize(name)
1413   super(:custom)
1414   @name = name
1415 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
1432 def assert(value, message = nil, &block)
1433   Util.assert_instance_of(CustomData, value, message, &block)
1434   Util.assert_equal(self, value.class.type, message, &block)
1435 end
eql?(other) click to toggle source
     # File lib/cassandra/types.rb
1451 def eql?(other)
1452   other.is_a?(Custom) && @name == other.name
1453 end
Also aliased as: ==
hash() click to toggle source
     # File lib/cassandra/types.rb
1442 def hash
1443   @hash ||= begin
1444     h = 17
1445     h = 31 * h + @kind.hash
1446     h = 31 * h + @name.hash
1447     h
1448   end
1449 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
1421 def new(*value)
1422   raise ::NotImplementedError,
1423         "unable to create a value for custom type: #{@name.inspect}"
1424 end
to_s() click to toggle source

@return [String] a cassandra representation of this type

     # File lib/cassandra/types.rb
1438 def to_s
1439   "'#{@name}'"
1440 end