Class: Linkage::Group
- Inherits:
-
Object
- Object
- Linkage::Group
- Defined in:
- lib/linkage/group.rb
Overview
This class represents a group of records that match based on criteria described via the Dataset#link_with method. Group’s are created by subclasses of the Runner class during execution.
Instance Attribute Summary collapse
-
#records ⇒ Array<Object>
readonly
An array of this group’s record ids.
-
#values ⇒ Hash
readonly
Hash of matching values.
Instance Method Summary collapse
-
#add_record(record_id) ⇒ Object
Add a record id to this group’s set of records.
-
#count ⇒ Fixnum
Number of records in this group.
-
#initialize(matching_values) ⇒ Group
constructor
A new instance of Group.
-
#matches?(values) ⇒ Boolean
Check to see if the given set of values matches this group’s values.
Constructor Details
#initialize(matching_values) ⇒ Group
Returns a new instance of Group.
18 19 20 21 |
# File 'lib/linkage/group.rb', line 18 def initialize(matching_values) @values = matching_values @records = [] end |
Instance Attribute Details
#records ⇒ Array<Object> (readonly)
Returns An array of this group’s record ids.
10 11 12 |
# File 'lib/linkage/group.rb', line 10 def records @records end |
#values ⇒ Hash (readonly)
Returns Hash of matching values.
13 14 15 |
# File 'lib/linkage/group.rb', line 13 def values @values end |
Instance Method Details
#add_record(record_id) ⇒ Object
Add a record id to this group’s set of records.
34 35 36 |
# File 'lib/linkage/group.rb', line 34 def add_record(record_id) @records << record_id end |
#count ⇒ Fixnum
Returns Number of records in this group.
39 40 41 |
# File 'lib/linkage/group.rb', line 39 def count @records.count end |
#matches?(values) ⇒ Boolean
Check to see if the given set of values matches this group’s values.
27 28 29 |
# File 'lib/linkage/group.rb', line 27 def matches?(values) @values == values end |