class OrderLastReview
Attributes
doc[RW]
Public Class Methods
new(doc)
click to toggle source
# File lib/order_payment.rb, line 88 def initialize(doc) self.doc = doc end
Public Instance Methods
to_s()
click to toggle source
# File lib/order_payment.rb, line 92 def to_s sections = doc.css(".l-section").map do |section| next unless section.css(".m-heading__caption").count > 0 section_name = section.css(".m-heading__caption").text.strip.gsub(/\s+/, " ").colorize(:green) rows = section.css("tr").map do |row| th = row.css(".m-input__heading").first || row.css("th").first th_text = th.text.strip.gsub(/\s+/, " ").colorize(:blue) td_text = row.css(".section_content_table_td").text. gsub(/ +/, " ").gsub(/\t+/, "").gsub(/(?:\r\n)+/, "\r\n").strip "#{th_text}\n#{td_text}" end "\n#{section_name}\n#{rows.join("\n")}" end sections.join("\n") end