Ruby 将引号包装到_yaml时不一致 介绍

Ruby 将引号包装到_yaml时不一致 介绍,ruby,Ruby,在下面的示例中,您可以看到标题和第1节和第11节已作为普通值放入yaml中,但第2节和第8节已用单引号括起来。这似乎发生在to_yaml阶段,因为在散列中,一切看起来都正常。(我不是简单地加载yaml并将其转换回来,这只是为了简化示例) 我试过的 我试着看看是否有任何特殊的字符会引起混乱,但没有任何运气。例如,在单词车辆的上有一个卷曲的撇号,而不是一个直撇号,,但在所有章节中都可以找到不是第2节中的有一个直撇号。我试着在不同的部分系统地添加/删除每种类型的撇号,看看这是否会有什么不同,但没有 f

在下面的示例中,您可以看到标题和第1节和第11节已作为普通值放入yaml中,但第2节和第8节已用单引号括起来。这似乎发生在
to_yaml
阶段,因为在散列中,一切看起来都正常。(我不是简单地加载yaml并将其转换回来,这只是为了简化示例)

我试过的 我试着看看是否有任何特殊的字符会引起混乱,但没有任何运气。例如,在单词
车辆的
上有一个卷曲的撇号
,而不是一个直撇号
,但在所有章节中都可以找到<代码>不是第2节中的
有一个直撇号。我试着在不同的部分系统地添加/删除每种类型的撇号,看看这是否会有什么不同,但没有

foo.yml
en:
合同:
条款和条件:
FF:
公司名称:富富
西班牙签入公司:Foo Foo西班牙单反
标题:租赁协议
标题:“本租赁协议规定了富富之间的租赁条件,以下简称租赁协议
公司和客户,由有效驾驶执照确定,以下简称租用人,由所有
本协议中描述的一般和特殊条件,除非有任何书面减损或变更。”
第1栏:
第1节:
标题:1。车辆状况
正文:“1)客户承认已收到车辆并租用了处于清洁状态且所有功能正常的额外车辆。2) 客户将在租赁协议中规定的归还日期、时间和地点,以清洁的状态归还车辆,在取车时使用相同的燃油量,并使车辆的所有功能正常运行。根据租赁公司价格表,未能满足这些标准将导致租客收取额外费用。租用额外物品、设备或备件的任何损失或损坏,将根据租赁公司价格表向租用人全额收取。”
第2节:
标题:2.文件
正文:“需要有效的车辆驾驶执照、身份证或护照和信用卡(Visa或Mastercard),并且必须在车辆领取和签署租赁协议时出示。如果租用人未携带必要的证件,车辆将无法租用,并将收取定期的不参展费。2) 租用人有责任持有有效的欧洲驾驶执照3)租用人的年龄应超过18岁。4) 如果租车人未满25岁,则必须购买标准保险计划,并且租车时不允许他/她购买基本或全部保险计划。
5) 信用卡车主必须出席车辆的托收。
"
第2栏:
第8节:
标题:8.事故/车辆损坏
正文:“如果发生事故或车辆损坏,承租人同意以下程序:1)立即通知租赁公司和警察当局任何事故、盗窃、抢劫或其他不幸事件。2) 拍照并获取所有相关人员和证人的姓名和地址,以记录所发生的情况3)填写事故报告以及可能涉及的其他车辆。4) 未采取所有保护和保护措施,不得离开车辆。5) 如果发生可能使租赁公司承担责任的事故,则不承担任何责任或认罪6)收集所有相关方签署的事故报告和警察部门准备的文件,以及车钥匙(如果车辆被盗),并立即将其发送给租赁公司。否则,所有保险和保险将到期,租用人负责所有费用。”
第11节:
标题:11.责任/保证金和租金支付后
正文:“1)保证金只能通过信用卡(Visa或Mastercard)支付,信用卡持有人必须在提货时在场。在车辆交付时,租车人需要根据选择的保险选项支付保证金。这笔款项将保存在租车人的信用卡中,以确保在租车期间发生抢劫或事故以及任何其他车辆损坏时支付超额款项。2) 如果保证金金额未经银行或信用卡所有人授权,则合同无法执行,车辆无法交付。在这种情况下,将适用定期取消政策,并向租用人收取全部预订金额。租赁期结束时,租赁公司工作人员检查车辆后,应将押金退还给租车人,并说明车辆的状况与取款时相似。3) 车辆损坏和设备/额外损坏费用将根据租赁公司价格表收取。根据争议中的损害赔偿金,租车人还将对车辆合理维修时间内未租用的天数负责。4)在承租人不认为自己承担责任的事故中,租赁公司将持有全部保证金直至保险公司承担责任。5) 如果无法立即确定损坏修复费用,租赁公司将持有全额保证金。如果最终损坏维修费用低于支付的金额,则可以退还部分超额费用。6) 承租人同意,租赁公司有权对可能产生的任何进一步金额(如野营、停车罚单、罚款、交通违规等)向信用卡收取备案费用
=> {"en"=>
  {"contract"=>
    {"terms_and_conditions"=>
      {"FF"=>
        {"company"=>"Foo Foo SA",
         "spain_checkin_company"=>"Foo Foo Spain SLR",
         "title"=>"Rental Agreement",
         "header"=>
          "This Rental Agreement regulates the rental conditions between Foo Foo, hereinafter referred to as the Rental Firm, and the client, identified by a valid driving license, hereinafter referred to as the Hirer, and it is ruled by all the general and special conditions described in this agreement, unless there is any written derogation or alteration.",
         "column_1"=>
          {"section_1"=>
            {"title"=>"1. Vehicle conditions",
             "text"=>
              "1) The customer acknowledges having received the Vehicle and rented extras in a clean condition and with all the features working. 2) The customer will return the vehicle in a clean condition, with the same amount of fuel at the pick-up, and with all the vehicle’s features operating in a normal way, on the return date, time and location established in the Rental Agreement. Failure to meet these criteria will result in additional charges to the Hirer according to the rental firm price table. Any loss or damage in rented extras, equipment or spare parts, will be fully charged to the Hirer according to the Rental Firm price table."},
           "section_2"=>
            {"title"=>"2. Documents",
             "text"=>
              "A valid vehicle driver’s license, ID or Passport and credit card (Visa or Mastercard) are required and must be presented upon the vehicle’s collection and signing of the rental agreement. If the Hirer does not bring the necessary documents, the vehicle cannot be rented and regular no show fee will apply. 2) To hold a valid license to drive in Europe is the responsibility of the Hirer 3) The Hirer should be older than 18 years old. 4) If the Hirer is under 25 years of age, purchasing the Standard Insurance plan is mandatory, and he/she isn't allowed to purchase the Basic or Full Insurance plan when renting a vehicle. 5) The credit card owner must be present at the vehicle´s collection. "}},
         "column_2"=>
          {"section_8"=>
            {"title"=>"8. Accident / Vehicle Damage",
             "text"=>
              "In the event of an accident or vehicle damage, the Hirer agrees to the following procedures: 1) Immediately notify the Rental Firm and police authorities of any accident, theft, robbery or other misfortune. 2) Take pictures and obtain names and addresses of all persons involved as well as witnesses, that can document what happened 3) Fill the accident report, together with other vehicles that may be involved. 4) Shall not leave the vehicle without taking all measures regarding its protection and . 5) Shall not take any responsibility or pled guilty, in the event of an accident that might hold the Rental Firm liable 6) Collect the accident report signed by all parties involved and the documents prepared by the police authorities, along with the vehicle keys, if retained (in case of vehicle theft) and send it immediately to the Rental firm. Otherwise, all insurances and coverage’s will expire, and the Hirer is liable for all expenses."},
           "section_11"=>
            {"title"=>"11. Liability / Security Deposit and After Rental Payments",
             "text"=>
              "1) The security deposit can only be paid by credit card (Visa or Mastercard), and the credit card owner must be present at the pick-up. At the vehicle delivery, the Hirer is required to pay the security deposit according to the chosen Insurance option. This amount will be held in the Hirer’s credit card to ensure the excess payment in the event of robbery or accident and any other vehicle damage during the rental period. 2) If the security deposit amount is not authorized by the bank or by the credit card owner, the contract cannot be executed and the vehicle cannot be delivered. In this case, the regular cancelation policy will apply and the full booking amount will be charged to the Hirer. The security deposit will be returned to the Hirer at the end of the rental period, after an inspection by a Rental Firm member staff, who shall state the vehicle is in similar conditions compared to when it was collected. 3) Vehicle damage and equipment/extras damage costs will be charged according to the Rental Firm price table. The Hirer will also be liable for the days not rented during the vehicle reasonable repair time, according to the damages at issue. 4) In case of an accident where the Hirer does not consider himself responsible, the Rental Firm will hold the full amount of the security deposit until the insurance company states the responsibility. 5) If the damage repair costs cannot be determined immediately, the Rental Firm will hold the full amount of the security deposit. A portion of the excess can be refunded in case the final damage repair costs are lower than the amount paid. 6) The Hirer agrees that the Rental Firm is authorized to charge the credit card on file for any further amounts that may arise such as wild camping, parking tickets, fines, traffic offence penalties, tolls, damages to the van (interior or exterior) and overdue amounts. Rental Firm is entitled to verify any of the damages to the van for 30 days after the last day of the rental agreement. In the event of a fine, the Rental Firm will always attempt to forward the fine to the Hirer. On these cases, a 25€ administrative fee will be charged by the Rental Firm. In the event that it is not possible to forward the fine to the Hirer, the Rental Firm will process the fine and charge to the Hirer the total cost of the fine plus VAT and an added administrative fee of 50€. 7) Hirer must provide the Rental Firm with an alternative credit card that can be used to meet Hirer’s obligations under the Rental Firm Terms and Conditions, in case of insufficient funds, declined transactions for any reason, and cancelled or suspended credit card. 8) All unpaid invoices will be added interest, which is the highest legal rate plus a flat fee, corresponding to 20% of the unpaid amount and any compensation for occurred damages / lost profits due by law. In the event of a legal dispute somehow related with this contract, the parties agree that the jurisdiction of the pick-up location will be applied."}}}}}}}

File.open("#{@PATH}foo.yml", "w") do |f|
              YAML.dump(foo,f)
            end