Class: SMPTool::VirtualVolume::DataEntryHeader

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

Overview

Header of a ‘virtual’ data entry.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ DataEntryHeader

Returns a new instance of DataEntryHeader.



11
12
13
14
15
16
17
18
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 11

def initialize(params)
  @status = params[:status]
  @filename = params[:filename]
  @n_clusters = params[:n_clusters]
  @ch_job = params[:ch_job]
  @date = params[:date]
  @extra_word = params[:extra_word] || Basic10::ENTRY_EXTRA_WORD
end

Instance Attribute Details

#ch_jobObject (readonly)

Returns the value of attribute ch_job.



9
10
11
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 9

def ch_job
  @ch_job
end

#dateObject (readonly)

Returns the value of attribute date.



9
10
11
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 9

def date
  @date
end

#extra_wordObject (readonly)

Returns the value of attribute extra_word.



9
10
11
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 9

def extra_word
  @extra_word
end

#filenameObject (readonly)

Returns the value of attribute filename.



9
10
11
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 9

def filename
  @filename
end

#n_clustersObject (readonly)

Returns the value of attribute n_clusters.



9
10
11
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 9

def n_clusters
  @n_clusters
end

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 9

def status
  @status
end

Instance Method Details

#cleanObject



55
56
57
58
59
60
61
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 55

def clean
  make_empty

  rename(
    [PAD_WORD, PAD_WORD, PAD_WORD]
  )
end

#empty_entry?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 43

def empty_entry?
  @status == EMPTY_ENTRY
end

#make_emptyObject



51
52
53
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 51

def make_empty
  _set_status(EMPTY_ENTRY)
end

#make_permanentObject



47
48
49
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 47

def make_permanent
  _set_status(PERM_ENTRY)
end

#permanent_entry?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 39

def permanent_entry?
  @status == PERM_ENTRY
end


20
21
22
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 20

def print_ascii_filename
  Filename.new(radix50: @filename).print_ascii
end

#rename(new_radix_id) ⇒ Object



63
64
65
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 63

def rename(new_radix_id)
  @filename = new_radix_id
end

#resize(new_size) ⇒ Object



35
36
37
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 35

def resize(new_size)
  @n_clusters = new_size
end

#snapshotObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/smp_tool/virtual_volume/data_entry_header.rb', line 24

def snapshot
  {
    status: _status_snapshot,
    filename: print_ascii_filename,
    n_clusters: @n_clusters,
    ch_job: @ch_job,
    date: @date,
    extra_word: @extra_word
  }
end