Class: OrderItems

Inherits:
Array
  • Object
show all
Defined in:
lib/order_review.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(source) ⇒ Object



43
44
45
46
47
# File 'lib/order_review.rb', line 43

def self.from(source)
  doc = Nokogiri::HTML(source)
  order_items = doc.css(".m-side_orderItems li").map { |item| OrderItem.new(item) }
  OrderItems.new(order_items)
end

Instance Method Details

#to_sObject



49
50
51
# File 'lib/order_review.rb', line 49

def to_s
  map(&:to_s).join("\n")
end