Class: ActiveExcel::ValidatedRecords

Inherits:
Object
  • Object
show all
Defined in:
lib/active_excel/validated_records.rb

Instance Method Summary collapse

Constructor Details

#initialize(table_name, records) ⇒ ValidatedRecords

Returns a new instance of ValidatedRecords.



5
6
7
8
# File 'lib/active_excel/validated_records.rb', line 5

def initialize(table_name, records)
  @table_name = table_name
  @records    = records
end

Instance Method Details

#all_recordsObject



10
11
12
# File 'lib/active_excel/validated_records.rb', line 10

def all_records
  @records
end

#invalid_recordsObject



18
19
20
# File 'lib/active_excel/validated_records.rb', line 18

def invalid_records
  @records.reject(&:valid?)
end

#valid_recordsObject



14
15
16
# File 'lib/active_excel/validated_records.rb', line 14

def valid_records
  @records.select(&:valid?)
end