Class: Cassandra::Types::Set
- Inherits:
-
Cassandra::Type
- Object
- Cassandra::Type
- Cassandra::Types::Set
- Defined in:
- lib/cassandra/types.rb
Instance Method Summary collapse
-
#assert(value, message = nil, &block) ⇒ void
Asserts that a given value is an Set.
- #eql?(other) ⇒ Boolean (also: #==)
-
#kind ⇒ Symbol
:set
. -
#new(*value) ⇒ Set
Coerces the value to Set.
-
#to_s ⇒ String
"set<type>"
.
Instance Method Details
#assert(value, message = nil, &block) ⇒ void
This method returns an undefined value.
Asserts that a given value is an Set
914 915 916 917 918 919 920 |
# File 'lib/cassandra/types.rb', line 914 def assert(value, = nil, &block) Util.assert_instance_of(::Set, value, , &block) value.each do |v| Util.assert_type(@value_type, v, , &block) end nil end |
#eql?(other) ⇒ Boolean Also known as: ==
928 929 930 |
# File 'lib/cassandra/types.rb', line 928 def eql?(other) other.is_a?(Set) && @value_type == other.value_type end |
#kind ⇒ Symbol
Returns :set
.
863 864 865 |
# File 'lib/cassandra/types.rb', line 863 def kind :set end |
#new(*value) ⇒ Set
Coerces the value to Set
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 |
# File 'lib/cassandra/types.rb', line 885 def new(*value) value = value.first if value.one? case value when ::Array result = ::Set.new value.each do |v| Util.assert_type(@value_type, v) result << v end result when ::Set value.each do |v| Util.assert_type(@value_type, v) end value else Util.assert_type(@value_type, value) ::Set[value] end end |
#to_s ⇒ String
Returns "set<type>"
.
924 925 926 |
# File 'lib/cassandra/types.rb', line 924 def to_s "set<#{@value_type.to_s}>" end |