Class: EhbrsRubyUtils::Vg::Ps2::IsoFile
Constant Summary
collapse
- CODE_PATTERN =
/[a-zA-Z]{4}_[0-9]{3}\.[0-9]{2}/.freeze
- CODE_PARSER =
CODE_PATTERN.to_parser(&:to_s)
Fs::Iso9660File::DEFAULT_EXTNAME
Instance Method Summary
collapse
#isoinfo_command, #list
Instance Method Details
#basename_nocode_noext ⇒ String
19
20
21
|
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 19
def basename_nocode_noext
path.basename_noext.to_path.gsub(/\A#{::Regexp.quote(code)}/, '')
end
|
#code ⇒ String
14
15
16
|
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 14
def code
list.lazy.map { |line| CODE_PARSER.parse(line) }.find(&:present?)
end
|
#target_path ⇒ Path
24
25
26
27
28
|
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 24
def target_path
path.basename_sub do |_b|
"#{code}.#{path_basename}#{DEFAULT_EXTNAME}"
end
end
|
#valid? ⇒ Boolean
31
32
33
|
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 31
def valid?
super && code.present?
end
|