@@ -0,0 +1,29 @@
miss shebang ?
what's mean shebang?
#!/usr/bin/env ruby
it not an execution script, no need add this line
Thanks, Shenwei
Thanks, Liushaofei
Thanks, Shenwei
Thanks, Liushaofei
+# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true
+require 'erb' +require_relative "#{ENV['LKP_SRC']}/lib/hashugar"
+# saves the context required by expand erb templates +class Context
- attr_reader :info
- def initialize(mac, hostname, queues)
- @info = {
'mac' => mac,
'hostname' => hostname,
'queues' => queues
- }
- end
- def merge!(hash)
- @info.merge!(hash)
- end
- def expand_erb(template, context_hash = {})
- @info.merge!(context_hash)
- context = Hashugar.new(@info).instance_eval { binding }
- ERB.new(template, nil, '%').result(context)
- end
+end
2.23.0