Class: Hashematics::RecordSet
- Inherits:
-
Object
- Object
- Hashematics::RecordSet
- Defined in:
- lib/hashematics/record_set.rb
Overview
A RecordSet creates Records and maintains a master list of Records.
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
- #add(object) ⇒ Object
-
#initialize ⇒ RecordSet
constructor
A new instance of RecordSet.
- #rows ⇒ Object
Constructor Details
#initialize ⇒ RecordSet
15 16 17 18 19 |
# File 'lib/hashematics/record_set.rb', line 15 def initialize @records = [] freeze end |
Instance Attribute Details
#records ⇒ Object (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 |
#rows ⇒ Object
21 22 23 |
# File 'lib/hashematics/record_set.rb', line 21 def rows records.map(&:data) end |