Class DataMapper::Support::TypedSet
In: lib/data_mapper/support/typed_set.rb
lib/data_mapper/support/typed_set.rb
Parent: Object

Methods

+   +   <<   <<   blank?   blank?   clear   clear   concat   concat   delete?   delete?   each   each   empty?   empty?   inspect   inspect   length   length   new   new   size   size  

Included Modules

::Enumerable ::Enumerable

Public Class methods

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 9
 9:       def initialize(*types)
10:         @types = types
11:         @set = SortedSet.new
12:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 9
 9:       def initialize(*types)
10:         @types = types
11:         @set = SortedSet.new
12:       end

Public Instance methods

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 51
51:       def +(other)
52:         x = self.class.new(*@types)
53:         each { |entry| x << entry }
54:         other.each { |entry| x << entry } unless other.blank?
55:         return x
56:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 51
51:       def +(other)
52:         x = self.class.new(*@types)
53:         each { |entry| x << entry }
54:         other.each { |entry| x << entry } unless other.blank?
55:         return x
56:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 14
14:       def <<(item)
15:         raise ArgumentError.new("#{item.inspect} must be a kind of: #{@types.inspect}") unless @types.any? { |type| type === item }
16:         @set << item
17:         return self
18:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 14
14:       def <<(item)
15:         raise ArgumentError.new("#{item.inspect} must be a kind of: #{@types.inspect}") unless @types.any? { |type| type === item }
16:         @set << item
17:         return self
18:       end
blank?()

Alias for empty?

blank?()

Alias for empty?

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 47
47:       def clear
48:         @set.clear
49:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 47
47:       def clear
48:         @set.clear
49:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 20
20:       def concat(values)
21:         [*values].each { |item| self << item }
22:         self
23:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 20
20:       def concat(values)
21:         [*values].each { |item| self << item }
22:         self
23:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 33
33:       def delete?(item)
34:         @set.delete?(item)
35:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 33
33:       def delete?(item)
34:         @set.delete?(item)
35:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 29
29:       def each
30:         @set.each { |item| yield(item) }
31:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 29
29:       def each
30:         @set.each { |item| yield(item) }
31:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 42
42:       def empty?
43:         @set.empty?
44:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 42
42:       def empty?
43:         @set.empty?
44:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 25
25:       def inspect
26:         "#<DataMapper::Support::TypedSet#{@types.inspect}: {#{entries.inspect[1...-1]}}>"
27:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 25
25:       def inspect
26:         "#<DataMapper::Support::TypedSet#{@types.inspect}: {#{entries.inspect[1...-1]}}>"
27:       end
length()

Alias for size

length()

Alias for size

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 37
37:       def size
38:         @set.size
39:       end

[Source]

    # File lib/data_mapper/support/typed_set.rb, line 37
37:       def size
38:         @set.size
39:       end

[Validate]