Class: Codabel::File

Inherits:
Object
  • Object
show all
Defined in:
lib/codabel/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(records = []) ⇒ File

Returns a new instance of File.



3
4
5
# File 'lib/codabel/file.rb', line 3

def initialize(records = [])
  @records = records
end

Instance Attribute Details

#recordsObject (readonly)

Returns the value of attribute records.



6
7
8
# File 'lib/codabel/file.rb', line 6

def records
  @records
end

Instance Method Details

#<<(record) ⇒ Object



8
9
10
# File 'lib/codabel/file.rb', line 8

def <<(record)
  @records << record
end

#find_record(type) ⇒ Object



16
17
18
# File 'lib/codabel/file.rb', line 16

def find_record(type)
  find_records(type).first
end

#find_records(type) ⇒ Object



12
13
14
# File 'lib/codabel/file.rb', line 12

def find_records(type)
  @records.select { |record| record.is_a?(type) }
end

#to_codaObject



24
25
26
# File 'lib/codabel/file.rb', line 24

def to_coda
  with_actual_records.auto_enrich._validate!._to_coda
end

#validate!Object



20
21
22
# File 'lib/codabel/file.rb', line 20

def validate!
  with_actual_records._validate!
end