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
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
|
#code ⇒ 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_path ⇒ 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
28
29
30
|
# File 'lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb', line 28
def valid?
super && code.present?
end
|