Class: Hashematics::RecordSet

Inherits:
Object
  • Object
show all
Defined in:
lib/hashematics/record_set.rb

Overview

A RecordSet creates Records and maintains a master list of Records.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecordSet



15
16
17
18
19
# File 'lib/hashematics/record_set.rb', line 15

def initialize
  @records = []

  freeze
end

Instance Attribute Details

#recordsObject (readonly)

Returns the value of attribute records.



13
14
15
# File 'lib/hashematics/record_set.rb', line 13

def records
  @records
end

Instance Method Details

#add(object) ⇒ Object



25
26
27
# File 'lib/hashematics/record_set.rb', line 25

def add(object)
  Record.new(object).tap { |r| records << r }
end

#rowsObject



21
22
23
# File 'lib/hashematics/record_set.rb', line 21

def rows
  records.map(&:data)
end