Class: Emf::Model::Metafile

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/emf/model/metafile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format:, header:, records:, errors: [], emf_plus: nil, trailing: "") ⇒ Metafile

Returns a new instance of Metafile.



8
9
10
11
12
13
14
15
# File 'lib/emf/model/metafile.rb', line 8

def initialize(format:, header:, records:, errors: [], emf_plus: nil, trailing: "")
  @format = format
  @header = header
  @records = records.freeze
  @errors = errors.freeze
  @emf_plus = emf_plus
  @trailing = trailing.freeze
end

Instance Attribute Details

#emf_plusObject (readonly)

Returns the value of attribute emf_plus.



17
18
19
# File 'lib/emf/model/metafile.rb', line 17

def emf_plus
  @emf_plus
end

#errorsObject (readonly)

Returns the value of attribute errors.



17
18
19
# File 'lib/emf/model/metafile.rb', line 17

def errors
  @errors
end

#formatObject (readonly)

Returns the value of attribute format.



17
18
19
# File 'lib/emf/model/metafile.rb', line 17

def format
  @format
end

#headerObject (readonly)

Returns the value of attribute header.



17
18
19
# File 'lib/emf/model/metafile.rb', line 17

def header
  @header
end

#recordsObject (readonly)

Returns the value of attribute records.



17
18
19
# File 'lib/emf/model/metafile.rb', line 17

def records
  @records
end

#trailingObject (readonly)

Returns the value of attribute trailing.



17
18
19
# File 'lib/emf/model/metafile.rb', line 17

def trailing
  @trailing
end

Instance Method Details

#each(&block) ⇒ Object



19
20
21
22
23
# File 'lib/emf/model/metafile.rb', line 19

def each(&block)
  return to_enum unless block

  @records.each(&block)
end

#errors?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/emf/model/metafile.rb', line 25

def errors?
  !@errors.empty?
end

#ok?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/emf/model/metafile.rb', line 29

def ok?
  @errors.empty?
end