5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/kumi/frontends.rb', line 5
def self.load(path:, inputs: {})
mode = ENV["KUMI_PARSER"] || "auto" ext = File.extname(path)
return Text.load(path:, inputs:) if mode == "text"
return Ruby.load(path:, inputs:) if mode == "ruby"
if mode == "auto" && ext == ".rb"
kumi_path = path.sub(/\.rb\z/, ".kumi")
return Text.load(path: kumi_path, inputs: inputs) if File.exist?(kumi_path)
end
return Text.load(path:, inputs:) if ext == ".kumi"
return Ruby.load(path:, inputs:) if ext == ".rb"
Ruby.load(path:, inputs:)
end
|