Class: SMPTool::VirtualVolume::Utils::FileConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/smp_tool/virtual_volume/utils/file_converter.rb

Overview

Converts hashes to data entry objects.

Instance Method Summary collapse

Constructor Details

#initialize(f_hash, extra_word, &block) ⇒ FileConverter

Returns a new instance of FileConverter.



10
11
12
13
14
15
16
17
# File 'lib/smp_tool/virtual_volume/utils/file_converter.rb', line 10

def initialize(f_hash, extra_word, &block)
  str = _process_data(f_hash[:data], &block)
  @n_clusters = _calc_n_clusters(str)
  @data = str.ljust(@n_clusters * CLUSTER_SIZE, PAD_CHR)

  @filename = f_hash[:filename]
  @extra_word = extra_word
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/smp_tool/virtual_volume/utils/file_converter.rb', line 19

def call
  DataEntry.new(
    header: _make_header,
    data: @data
  )
end