Class: DataMapper::RelationshipSet

Inherits:
SubjectSet show all
Defined in:
lib/dm-core/relationship_set.rb

Overview

A SubjectSet that keeps track of relationships defined in a Model

Instance Attribute Summary

Attributes inherited from SubjectSet

#entries

Instance Method Summary collapse

Methods inherited from SubjectSet

#<<, #[], #clear, #delete, #each, #empty?, #include?, #initialize, #initialize_copy, #named?, #size, #to_ary, #values_at

Constructor Details

This class inherits a constructor from DataMapper::SubjectSet

Instance Method Details

#each_value {|DataMapper::Associations::Relationship| ... } ⇒ RelationshipSet

Deprecated.

use DataMapper::RelationshipSet#each instead

A list of all relationships in this set

Yields:

Yield Parameters:

Returns:


33
34
35
36
37
# File 'lib/dm-core/relationship_set.rb', line 33

def each_value
  warn "#{self.class}#each_value is deprecated. Use #{self.class}#each instead: #{caller.first}"
  each { |relationship| yield(relationship) }
  self
end

#has_key?(name) ⇒ Boolean

Deprecated.

use DataMapper::RelationshipSet#named? instead

Check wether this RelationshipSet includes an entry with the given name

Parameters:

  • name (#to_s)

    the name of the entry to look for

Returns:

  • (Boolean)

    true if the set contains a relationship with the given name


66
67
68
69
# File 'lib/dm-core/relationship_set.rb', line 66

def has_key?(name)
  warn "#{self.class}#has_key? is deprecated. Use #{self.class}#named? instead: #{caller.first}"
  named?(name)
end

#key?(name) ⇒ Boolean

Deprecated.

use DataMapper::RelationshipSet#named? instead

Check wether this RelationshipSet includes an entry with the given name

Parameters:

  • name (#to_s)

    the name of the entry to look for

Returns:

  • (Boolean)

    true if the set contains a relationship with the given name


50
51
52
53
# File 'lib/dm-core/relationship_set.rb', line 50

def key?(name)
  warn "#{self.class}#key? is deprecated. Use #{self.class}#named? instead: #{caller.first}"
  named?(name)
end

#valuesArray

Deprecated.

use DataMapper::RelationshipSet#each or DataMapper::RelationshipSet#to_a instead

A list of all relationships in this set

Returns:

  • (Array)

    a list of all relationships in the set


15
16
17
18
# File 'lib/dm-core/relationship_set.rb', line 15

def values
  warn "#{self.class}#values is deprecated. Use #{self.class}#each or #{self.class}#to_a instead: #{caller.first}"
  to_a
end