Class: ModpackLocalizer::QuestGiver::Reader
- Inherits:
-
Object
- Object
- ModpackLocalizer::QuestGiver::Reader
- Defined in:
- lib/modpack_localizer/quest_giver/reader.rb
Overview
Quest GiverのJSONファイルから翻訳対象テキストを抽出するクラス
Constant Summary collapse
- TRANSLATABLE_PATHS =
[ %w[start title text], %w[start description text], %w[complete title text], %w[complete description text] ].freeze
Instance Method Summary collapse
-
#extract_all(file_path) ⇒ Array<Hash>
JSONファイルから翻訳対象テキストを抽出する.
Instance Method Details
#extract_all(file_path) ⇒ Array<Hash>
JSONファイルから翻訳対象テキストを抽出する
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/modpack_localizer/quest_giver/reader.rb', line 18 def extract_all(file_path) json = JSON.parse(File.read(file_path)) TRANSLATABLE_PATHS.filter_map do |keys| value = json.dig(*keys) next unless value { type: :quest_giver, path: keys.join("."), text: value } end end |