Class: Micdrop::Ext::Microfocus::MicroFocusReader

Inherits:
Object
  • Object
show all
Defined in:
lib/micdrop/ext/microfocus.rb

Overview

Read a MicroFocus data file

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_file, unpack_spec: nil, unpack_mapping: nil) ⇒ MicroFocusReader

Returns a new instance of MicroFocusReader.



70
71
72
73
74
75
# File 'lib/micdrop/ext/microfocus.rb', line 70

def initialize(data_file, unpack_spec: nil, unpack_mapping: nil)
  @data_file = data_file
  @unpack_spec = unpack_spec
  @unpack_mapping = unpack_mapping
  read_data_header
end

Instance Attribute Details

#compressionObject (readonly)

Returns the value of attribute compression.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def compression
  @compression
end

#creation_timeObject (readonly)

Returns the value of attribute creation_time.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def creation_time
  @creation_time
end

#index_typeObject (readonly)

Returns the value of attribute index_type.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def index_type
  @index_type
end

#index_versionObject (readonly)

Returns the value of attribute index_version.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def index_version
  @index_version
end

#max_lengthObject (readonly)

Returns the value of attribute max_length.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def max_length
  @max_length
end

#min_legthObject (readonly)

Returns the value of attribute min_legth.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def min_legth
  @min_legth
end

#variable_lengthObject (readonly)

Returns the value of attribute variable_length.



77
78
79
# File 'lib/micdrop/ext/microfocus.rb', line 77

def variable_length
  @variable_length
end

Instance Method Details

#eachObject



95
96
97
98
99
# File 'lib/micdrop/ext/microfocus.rb', line 95

def each
  return enum_for :each unless block_given?

  yield read_record until @data_file.eof?
end

#indexed?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/micdrop/ext/microfocus.rb', line 87

def indexed?
  @organization == RecordOrganization::INDEXED
end

#long_records?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/micdrop/ext/microfocus.rb', line 79

def long_records?
  @long_records
end

#relative?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/micdrop/ext/microfocus.rb', line 91

def relative?
  @organization == RecordOrganization::RELATIVE
end

#sequential?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/micdrop/ext/microfocus.rb', line 83

def sequential?
  @organization == RecordOrganization::SEQUENTIAL
end