Class: Luogu::CLI::Commands::Build

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/luogu/cli.rb

Instance Method Summary collapse

Instance Method Details

#call(prompt_file: nil, target_file: nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/luogu/cli.rb', line 20

def call(prompt_file: nil, target_file: nil, **)
  target_file ||=  prompt_file.sub(File.extname(prompt_file), ".json")
  data = PromptParser.new(prompt_file).to_json
  File.open(target_file, 'w') do |f|
    f.write(data)
  end
end