
25 Feb
2021
25 Feb
'21
4:10 p.m.
On Thu, Feb 25, 2021 at 11:49:58AM +0800, Wu Fengguang wrote:
filed => field
private def get_boot_ipxe(job : Job) + return job["ipxe_response"] if job["ipxe_response"]?
What if job["ipxe_response"] exists but is nil/false?
如果你的意思是 "ipxe_response"字段是否存在,那么就把代码写成 字段是否存在。 避免间接和偷懒的if测试。 那容易让人误解,抓不住你原本的目的。
We may need to add has_key for Job class. Thanks, Xueliang
Thanks, Fengguang
response = "#!ipxe\n\n"
_initrds_uri = Array(String).from_json(job.initrds_uri).map { |uri| "initrd #{uri}" } -- 2.23.0