Class: EhbrsRubyUtils::Vg::Ps2::IsoFile

Inherits:
Fs::Iso9660File show all
Defined in:
lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb

Constant Summary collapse

CODE_PATTERN =
/[a-zA-Z]{4}_[0-9]{3}\.[0-9]{2}/.freeze
CODE_PARSER =
CODE_PATTERN.to_parser(&:to_s)

Constants inherited from Fs::Iso9660File

Fs::Iso9660File::DEFAULT_EXTNAME

Instance Method Summary collapse

Methods inherited from Fs::Iso9660File

#isoinfo_command, #list

Instance Method Details

#basename_nocode_noextString

Returns:

  • (String)


16
17
18
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 16

def basename_nocode_noext
  path.basename_noext.to_path.gsub(/\A#{::Regexp.quote(code)}/, '')
end

#codeString

Returns:

  • (String)


11
12
13
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 11

def code
  list.lazy.map { |line| CODE_PARSER.parse(line) }.find(&:present?)
end

#target_pathPath

Returns:

  • (Path)


21
22
23
24
25
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 21

def target_path
  path.basename_sub do |_b|
    "#{code}.#{path_basename}#{DEFAULT_EXTNAME}"
  end
end

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 28

def valid?
  super && code.present?
end