ehbrs_ruby_utils 0.32.0 → 0.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress.rb +2 -2
- data/lib/ehbrs_ruby_utils/bga/parsers/table/options.rb +3 -3
- data/lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb +1 -1
- data/lib/ehbrs_ruby_utils/bga/session/user.rb +1 -3
- data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb +1 -1
- data/lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb +1 -1
- data/lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb +1 -1
- data/lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb +42 -0
- data/lib/ehbrs_ruby_utils/cooking_book/build/index_page.rb +26 -0
- data/lib/ehbrs_ruby_utils/cooking_book/build/recipe_page.rb +26 -0
- data/lib/ehbrs_ruby_utils/cooking_book/build.rb +45 -0
- data/lib/ehbrs_ruby_utils/cooking_book/project.rb +31 -0
- data/lib/ehbrs_ruby_utils/cooking_book/recipe/ingredient.rb +21 -0
- data/lib/ehbrs_ruby_utils/cooking_book/recipe/measure.rb +60 -0
- data/lib/ehbrs_ruby_utils/cooking_book/recipe/part.rb +32 -0
- data/lib/ehbrs_ruby_utils/cooking_book/recipe.rb +37 -0
- data/lib/ehbrs_ruby_utils/cooking_book.rb +9 -0
- data/lib/ehbrs_ruby_utils/fs/selected/build.rb +1 -1
- data/lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb +1 -1
- data/lib/ehbrs_ruby_utils/patches/object/template.rb +2 -2
- data/lib/ehbrs_ruby_utils/patches/object.rb +1 -1
- data/lib/ehbrs_ruby_utils/patches.rb +1 -1
- data/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/lib/ehbrs_ruby_utils/vg/wii/file_move.rb +89 -0
- data/lib/ehbrs_ruby_utils/vg/wii/game_file.rb +87 -0
- data/lib/ehbrs_ruby_utils/vg/wii/wit/image_format.rb +47 -0
- data/lib/ehbrs_ruby_utils/vg/wii/wit/parsers/dump.rb +67 -0
- data/lib/ehbrs_ruby_utils/vg/wii/wit/parsers/info.rb +39 -0
- data/lib/ehbrs_ruby_utils/vg/wii/wit/path.rb +55 -0
- data/lib/ehbrs_ruby_utils/vg/wii/wit.rb +13 -0
- data/lib/ehbrs_ruby_utils/vg/wii.rb +11 -0
- data/lib/ehbrs_ruby_utils/vg.rb +9 -0
- data/lib/ehbrs_ruby_utils/videos/container.rb +1 -1
- data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors/subtitles_provider.rb +51 -0
- data/lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb +5 -0
- data/lib/ehbrs_ruby_utils/videos/quality.rb +1 -3
- data/lib/ehbrs_ruby_utils/videos/resolution.rb +2 -2
- data/lib/ehbrs_ruby_utils/videos/series/rename/file/basename_parser.rb +2 -2
- data/lib/ehbrs_ruby_utils/videos/series/rename/file.rb +2 -2
- data/lib/ehbrs_ruby_utils/videos/series/rename/line_result.rb +2 -2
- data/lib/ehbrs_ruby_utils/videos/series/rename/line_result_group.rb +1 -0
- data/lib/ehbrs_ruby_utils/videos/series/rename/season_group.rb +1 -0
- data/lib/ehbrs_ruby_utils/videos/stream.rb +1 -1
- data/lib/ehbrs_ruby_utils/web_utils/videos/file.rb +1 -1
- metadata +44 -146
- data/.rspec +0 -1
- data/.rubocop.yml +0 -45
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec.rb +0 -7
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-12.source.html +0 -8657
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-12.target.yaml +0 -41
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-19.source.html +0 -8650
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_84920871_2023-06-19.target.yaml +0 -41
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93167144_2023-06-12.source.html +0 -8657
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93167144_2023-06-12.target.yaml +0 -5
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93205235_2023-06-12.source.html +0 -8657
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93205235_2023-06-12.target.yaml +0 -13
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93212034_2023-06-12.source.html +0 -8657
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93212034_2023-06-12.target.yaml +0 -29
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93223573_2023-06-12.source.html +0 -8657
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93223573_2023-06-12.target.yaml +0 -7
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93248308_2023-06-12.source.html +0 -8657
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress_spec_files/player_93248308_2023-06-12.target.yaml +0 -1
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec.rb +0 -7
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/1.source.html +0 -1082
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/1.target.yaml +0 -151
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/2.source.html +0 -1083
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/game_stats_spec_files/2.target.yaml +0 -1127
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec.rb +0 -7
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_302873643.source.html +0 -1491
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_302873643.target.yaml +0 -40
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_308782287.source.html +0 -1965
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_308782287.target.yaml +0 -46
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_356513708.source.html +0 -1497
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_356513708.target.yaml +0 -56
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_357408039.source.html +0 -1500
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_357408039.target.yaml +0 -66
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_368448439.source.html +0 -1497
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_368448439.target.yaml +0 -58
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373602409.source.html +0 -1441
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373602409.target.yaml +0 -30
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373747455.source.html +0 -1521
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_373747455.target.yaml +0 -59
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_383405743.source.html +0 -1480
- data/spec/lib/ehbrs_ruby_utils/bga/parsers/table_spec_files/table_383405743.target.yaml +0 -32
- data/spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec.rb +0 -68
- data/spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.source.yaml +0 -124
- data/spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/ehbrs_music1.target.yaml +0 -70
- data/spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.source.yaml +0 -7
- data/spec/lib/ehbrs_ruby_utils/circular_list_spreader_spec_files/minimum.target.yaml +0 -5
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec.rb +0 -7
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.source.html +0 -993
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/counterpart_s01e01.target.yaml +0 -5
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.source.html +0 -478
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode_spec_files/wire-season-1-page-1.target.yaml +0 -43
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec.rb +0 -7
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.source.html +0 -763
- data/spec/lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/title_spec_files/countepart.target.yaml +0 -22
- data/spec/lib/ehbrs_ruby_utils/videos/resolution_spec.rb +0 -18
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb +0 -13
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.source.yaml +0 -28
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml +0 -8
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml +0 -49
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml +0 -8
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.source.yaml +0 -43
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml +0 -8
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml +0 -59
- data/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml +0 -8
- data/spec/rubocop_check_spec.rb +0 -3
- data/spec/spec_helper.rb +0 -4
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs/executables'
|
5
|
+
require 'ehbrs_ruby_utils/vg/wii/wit/parsers/info'
|
6
|
+
|
7
|
+
module EhbrsRubyUtils
|
8
|
+
module Vg
|
9
|
+
module Wii
|
10
|
+
module Wit
|
11
|
+
class ImageFormat
|
12
|
+
class << self
|
13
|
+
SECTION_NAME_PATTERN = /\A#{::Regexp.quote('IMAGE-FORMAT:')}(.+)\z/.freeze
|
14
|
+
|
15
|
+
enable_simple_cache
|
16
|
+
|
17
|
+
def by_name(name)
|
18
|
+
all.find { |i| i.name.downcase == name.to_s.downcase } ||
|
19
|
+
raise(::ArgumentError, "Image not found with name \"#{name.to_s.downcase}\" " \
|
20
|
+
"(Available: #{all.map(&:name).join(', ')})")
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def all_uncached
|
26
|
+
::EhbrsRubyUtils::Vg::Wii::Wit::Parsers::Info.new(info_output).images
|
27
|
+
.map do |_label, data|
|
28
|
+
new(
|
29
|
+
*%w[name info option].map { |k| data.fetch(k) },
|
30
|
+
*%w[extensions attributes].map { |k| data.fetch(k).to_s.split(/\s+/) }
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def info_output
|
36
|
+
::Ehbrs::Executables.wit.command
|
37
|
+
.append(%w[info image-format --sections])
|
38
|
+
.execute!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
common_constructor :name, :description, :option, :extensions, :attributes
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Vg
|
7
|
+
module Wii
|
8
|
+
module Wit
|
9
|
+
module Parsers
|
10
|
+
class Dump
|
11
|
+
enable_simple_cache
|
12
|
+
common_constructor :output
|
13
|
+
|
14
|
+
# WIA/WII (v1.00,LZMA2.7@100) & Wii
|
15
|
+
# ISO/WII & Wii
|
16
|
+
# WBFS/WII & Wii
|
17
|
+
# ISO/GC & GameCube
|
18
|
+
FILE_DISC_TYPE_PATTERN = %r{\A(\S+)/(\S+)\s+(?:\(([^\)]+)\)\s+)?&\s+(\S+)\z}.freeze
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def properties_uncached
|
23
|
+
r = {}
|
24
|
+
output.each_line do |line|
|
25
|
+
dump_output_line_to_hash(line).if_present { |v| r.merge!(v) }
|
26
|
+
end
|
27
|
+
r
|
28
|
+
end
|
29
|
+
|
30
|
+
def dump_output_line_to_hash(line)
|
31
|
+
m = /\A\s*([^:]+):\s+(.+)\z/.match(line.strip)
|
32
|
+
return nil unless m
|
33
|
+
|
34
|
+
parse_attribute(m[1].strip, m[2].strip)
|
35
|
+
end
|
36
|
+
|
37
|
+
def line_method_parser(label)
|
38
|
+
"parse_#{label}".parameterize.underscore
|
39
|
+
end
|
40
|
+
|
41
|
+
def parse_attribute(label, value)
|
42
|
+
method = line_method_parser(label)
|
43
|
+
return { label => value } unless respond_to?(method, true)
|
44
|
+
|
45
|
+
send(method, value).transform_keys { |k| "#{label}/#{k}" }
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_file_disc_type(value)
|
49
|
+
r = FILE_DISC_TYPE_PATTERN.match(value).if_present do |m|
|
50
|
+
{ type: m[1], platform_acronym: m[2], type_extra: m[3],
|
51
|
+
platform_name: m[4] }
|
52
|
+
end
|
53
|
+
r.if_blank { raise "\"#{FILE_DISC_TYPE_PATTERN}\" does not match \"#{value}\"" }
|
54
|
+
end
|
55
|
+
|
56
|
+
def parse_disc_part_ids(value)
|
57
|
+
value.split(',').to_h do |v|
|
58
|
+
r = v.strip.split('=')
|
59
|
+
[r[0].strip, r[1].strip]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs/executables'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'inifile'
|
7
|
+
|
8
|
+
module EhbrsRubyUtils
|
9
|
+
module Vg
|
10
|
+
module Wii
|
11
|
+
module Wit
|
12
|
+
module Parsers
|
13
|
+
class Info
|
14
|
+
SECTION_NAME_PATTERN = /\A#{::Regexp.quote('IMAGE-FORMAT:')}(.+)\z/.freeze
|
15
|
+
|
16
|
+
enable_simple_cache
|
17
|
+
common_constructor :output
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def images_uncached
|
22
|
+
ini = ::IniFile.new(content: output)
|
23
|
+
r = {}
|
24
|
+
ini.sections.each do |section_name|
|
25
|
+
image_section_name = parse_image_section_name(section_name)
|
26
|
+
r[image_section_name] = ini[section_name] if image_section_name.present?
|
27
|
+
end
|
28
|
+
r
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_image_section_name(section_name)
|
32
|
+
SECTION_NAME_PATTERN.match(section_name).if_present { |m| m[1] }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Vg
|
7
|
+
module Wii
|
8
|
+
module Wit
|
9
|
+
class Path
|
10
|
+
WIT_PATH_PATTERN = /\A(?:([a-z0-9]+):)?(.+)\z/i.freeze
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def assert(source)
|
14
|
+
source = parse(source) unless source.is_a?(self)
|
15
|
+
source
|
16
|
+
end
|
17
|
+
|
18
|
+
def parse(path)
|
19
|
+
WIT_PATH_PATTERN
|
20
|
+
.match(path)
|
21
|
+
.if_present { |m| new(m[1], m[2]) }
|
22
|
+
.if_blank { raise "\"#{WIT_PATH_PATTERN}\" does not match \"#{path}\"" }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
common_constructor :type, :path do
|
27
|
+
self.type = type.to_s.upcase
|
28
|
+
self.path = ::Pathname.new(path.to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
def change?(other)
|
32
|
+
type_change?(other) || path_change?(other)
|
33
|
+
end
|
34
|
+
|
35
|
+
def path_change?(other)
|
36
|
+
path.expand_path.to_s != other.path.expand_path.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s
|
40
|
+
r = path.to_s
|
41
|
+
r = "#{type.to_s.upcase}:#{r}" if type.present?
|
42
|
+
r
|
43
|
+
end
|
44
|
+
|
45
|
+
def type_change?(other)
|
46
|
+
return false if other.type.blank?
|
47
|
+
return true if type.blank?
|
48
|
+
|
49
|
+
type != other.type
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -43,7 +43,7 @@ module EhbrsRubyUtils
|
|
43
43
|
def song_metadata_uncached
|
44
44
|
::UltimateLyrics::SongMetadata.new(
|
45
45
|
::UltimateLyrics::SongMetadata::Field.lists.sources.values
|
46
|
-
.
|
46
|
+
.index_with { |source| tag.send(source) }
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aranha/default_processor'
|
4
|
+
require 'ehbrs_ruby_utils/videos/opensubtitles/processors/episode'
|
5
|
+
require 'ehbrs_ruby_utils/videos/opensubtitles/processors/title'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
|
8
|
+
module EhbrsRubyUtils
|
9
|
+
module Videos
|
10
|
+
module Opensubtitles
|
11
|
+
module Processors
|
12
|
+
class SubtitlesProvider < ::Aranha::DefaultProcessor
|
13
|
+
enable_simple_cache
|
14
|
+
|
15
|
+
delegate :perform, :subtitles, to: :sub_processor
|
16
|
+
|
17
|
+
# @return [Boolean]
|
18
|
+
def episode?
|
19
|
+
title_parser.data[:episodes].if_present(true, &:empty?)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# @return [Class]
|
25
|
+
def sub_processor_class
|
26
|
+
if episode?
|
27
|
+
::EhbrsRubyUtils::Videos::Opensubtitles::Processors::Episode
|
28
|
+
else
|
29
|
+
::EhbrsRubyUtils::Videos::Opensubtitles::Processors::Title
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [EhbrsRubyUtils::Videos::Opensubtitles::Parsers::Episode]
|
34
|
+
def episode_parser
|
35
|
+
::EhbrsRubyUtils::Videos::Opensubtitles::Parsers::Episode.new(source_uri)
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [EhbrsRubyUtils::Videos::Opensubtitles::Parsers::Title]
|
39
|
+
def title_parser
|
40
|
+
::EhbrsRubyUtils::Videos::Opensubtitles::Parsers::Title.new(source_uri)
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Aranha::DefaultProcessor]
|
44
|
+
def sub_processor_uncached
|
45
|
+
sub_processor_class.new(source_uri, extra_data)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -10,10 +10,10 @@ module EhbrsRubyUtils
|
|
10
10
|
module BasenameParser
|
11
11
|
FORMATS = [{
|
12
12
|
format: /(\d+)(\d{2})(\d{2})/i,
|
13
|
-
build: ->(m) { { s: padding(m[1]), e: padding(m[2])
|
13
|
+
build: ->(m) { { s: padding(m[1]), e: "#{padding(m[2])}-#{padding(m[3])}" } }
|
14
14
|
}, {
|
15
15
|
format: /s(\d+)e(\d+)-(\d+)/i,
|
16
|
-
build: ->(m) { { s: padding(m[1]), e: padding(m[2])
|
16
|
+
build: ->(m) { { s: padding(m[1]), e: "#{padding(m[2])}-#{padding(m[3])}" } }
|
17
17
|
}, {
|
18
18
|
format: /(\d{1,2})\s*[^\d]\s*(\d{2})/i,
|
19
19
|
build: ->(m) { { s: padding(m[1]), e: padding(m[2]) } }
|
@@ -13,7 +13,7 @@ module EhbrsRubyUtils
|
|
13
13
|
|
14
14
|
common_constructor :file, :options do
|
15
15
|
self.file = file.to_pathname.expand_path
|
16
|
-
self.options =
|
16
|
+
self.options = options.to_struct if options.is_a?(::Hash)
|
17
17
|
end
|
18
18
|
|
19
19
|
# @return [String]
|
@@ -70,7 +70,7 @@ module EhbrsRubyUtils
|
|
70
70
|
|
71
71
|
def kernel_from_directory_name
|
72
72
|
dir = dirname.basename.to_path.sub(/\([0-9]+\)/, '')
|
73
|
-
dir.split(/\W+/).select { |w| /\A[a-z0-9]/.match(w) }.map { |p| p[0].downcase }.join
|
73
|
+
dir.split(/\W+/).select { |w| /\A[a-z0-9]/.match(w) }.map { |p| p[0].downcase }.join
|
74
74
|
end
|
75
75
|
|
76
76
|
def extension
|
@@ -11,13 +11,13 @@ module EhbrsRubyUtils
|
|
11
11
|
enable_speaker
|
12
12
|
|
13
13
|
def show(level)
|
14
|
-
out(padding_level(level)
|
14
|
+
out("#{padding_level(level)}#{line_out}\n")
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def padding_level(level)
|
20
|
-
|
20
|
+
"#{' ' * level.to_i}* "
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|