Class: Cassandra::Types::List
- Inherits:
-
Cassandra::Type
- Object
- Cassandra::Type
- Cassandra::Types::List
- Defined in:
- lib/cassandra/types.rb
Instance Method Summary collapse
-
#assert(value, message = nil, &block) ⇒ void
Asserts that a given value is an Array.
- #eql?(other) ⇒ Boolean (also: #==)
-
#kind ⇒ Symbol
:list
. -
#new(*value) ⇒ Array
Coerces the value to Array.
-
#to_s ⇒ String
"list<type>"
.
Instance Method Details
#assert(value, message = nil, &block) ⇒ void
This method returns an undefined value.
Asserts that a given value is an Array
759 760 761 762 763 764 765 |
# File 'lib/cassandra/types.rb', line 759 def assert(value, = nil, &block) Util.assert_instance_of(::Array, value, , &block) value.each do |v| Util.assert_type(@value_type, v, , &block) end nil end |
#eql?(other) ⇒ Boolean Also known as: ==
773 774 775 |
# File 'lib/cassandra/types.rb', line 773 def eql?(other) other.is_a?(List) && @value_type == other.value_type end |
#kind ⇒ Symbol
Returns :list
.
735 736 737 |
# File 'lib/cassandra/types.rb', line 735 def kind :list end |
#new(*value) ⇒ Array
Coerces the value to Array
743 744 745 746 747 748 749 750 |
# File 'lib/cassandra/types.rb', line 743 def new(*value) value = Array(value.first) if value.one? value.each do |v| Util.assert_type(@value_type, v) end value end |
#to_s ⇒ String
Returns "list<type>"
.
769 770 771 |
# File 'lib/cassandra/types.rb', line 769 def to_s "list<#{@value_type.to_s}>" end |