Sha256: 23f7dcfe606c7dab64bbab001e76e677b4bc7c615af22f94ca1e5e44704945e1
Contents?: true
Size: 845 Bytes
Versions: 4
Compression:
Stored size: 845 Bytes
Contents
require_relative "../util/indent_helper" module ModpackLocalizer module SNBT # SNBT形式のファイルからtitle: "some title"を抽出するモジュール module TitleExtractor include IndentHelper # title: "some title"を抽出する # # @param [String] file_path ファイルのパス # @return [Array<Hash>] タイトルと行番号の配列 def extract_titles(file_path) titles = [] lines = File.readlines(file_path) lines.each_with_index do |line, index| next unless start_of?(line, key: :title) titles << { type: :title, text: extract_oneline(line), start_line: index, end_line: index, indent: count_indent(line) } end titles end end end end
Version data entries
4 entries across 4 versions & 1 rubygems