Module: ModpackLocalizer::SNBT::SubtitleExtractor
- Includes:
- IndentHelper
- Included in:
- Reader
- Defined in:
- lib/modpack_localizer/snbt/subtitle_extractor.rb
Overview
SNBT形式のファイルからsubtitle: “some subtitle”を抽出するモジュール
Instance Method Summary collapse
-
#extract_subtitles(file_path) ⇒ Array<Hash>
subtitle: “some subtitle”を抽出する.
Methods included from IndentHelper
#count_indent, #create_indent, #middle_indent
Instance Method Details
#extract_subtitles(file_path) ⇒ Array<Hash>
subtitle: “some subtitle”を抽出する
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/modpack_localizer/snbt/subtitle_extractor.rb', line 13 def extract_subtitles(file_path) subtitles = [] lines = File.readlines(file_path) lines.each_with_index do |line, index| next unless start_of?(line, key: :subtitle) subtitles << { type: :subtitle, text: extract_oneline(line), start_line: index, end_line: index, indent: count_indent(line) } end subtitles end |